On Thursday, July 14, 2016 at 7:21:30 PM UTC+1, Rui Lopes wrote: > > For some reason I'm getting the following error: > > ==> test: del : Cannot remove item > C:\Windows\Temp\WinRM_Elevated_Shell.log: The process cannot access the file > ==> test: 'C:\Windows\Temp\WinRM_Elevated_Shell.log' because it is being > used by another process. > ==> test: At C:\tmp\vagrant-elevated-shell.ps1:19 char:3 > ==> test: + del $out_file > ==> test: + ~~~~~~~~~~~~~ > ==> test: + CategoryInfo : WriteError: > (C:\Windows\Temp\WinRM_Elevated_Shell.log:FileInfo) [Remove-Item], IOExcepti > ==> test: on > ==> test: + FullyQualifiedErrorId : > RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand > > My Vagrantfile has something like: > > config.vm.provision "shell", inline: "c:/tmp/provision/install-a.ps1", > name: "Install a" > config.vm.provision "shell", inline: "c:/tmp/provision/install-b.ps1", > name: "Install b" > > The error happens when its trying to run the second provision script. > > Looking at > https://github.com/mitchellh/vagrant/blob/master/plugins/communicators/winrm/scripts/elevated_shell.ps1.erb > > <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fmitchellh%2Fvagrant%2Fblob%2Fmaster%2Fplugins%2Fcommunicators%2Fwinrm%2Fscripts%2Felevated_shell.ps1.erb&sa=D&sntz=1&usg=AFQjCNHngoARhIMqXaTztl9h5iqqgigy5A> > > it seems that the scheduled task that is created by the first provision > script is somehow still running... is that it? if so how can that happen > when elevated_shell.ps1.erb is checking (while (!($registered_task.state > -eq 3))) is still running? Maybe that check is not enough? Maybe it should > really wait for the task to close the log file? >
That was it! I've modified the elevated_shell.ps1.erb to https://github.com/mitchellh/vagrant/pull/7584 :-) -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/vagrant/issues IRC: #vagrant on Freenode --- You received this message because you are subscribed to the Google Groups "Vagrant" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/a99ac197-0a57-4436-bb11-4aff75ee234d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
