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
 
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?

TIA!

PS Host and Guest is Windows 10 64-bit. Vagrant is 1.8.4. VirtualBox is 
5.0.24r108355.

-- 
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/e39c2b51-389c-429c-8702-389ddd4fcf0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to