3
我不知道從哪裏開始解決這個問題。我正在使用modernIE\w7-ie8
框。我第一次啓動它(vagrant up
從頭開始),就需要手動調整以獲得流浪連接:爲什麼在刪除WinRM日誌時Windows客戶端調配失敗?
- 繼續/通過啓動恢復/修復對話框
- 更改網絡類型從公共取消Work/Home
之後,我有三個短shell規定語句:註冊一些DLL,安裝Chocolatey,並安裝一個Chocolatey包。
Vagrantfile:
config.vm.provision "shell", inline: "regsvr32 foo/Foo.dll"
config.vm.provision "shell", inline: "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
config.vm.provision "shell", inline: "choco install foo -y"
輸出:
PS> vagrant provision
==> default: Running provisioner: shell...
default: Running: inline PowerShell script
==> default: Running provisioner: shell...
default: Running: inline PowerShell script
==> default: Remove-Item : Cannot remove item C:\Windows\Temp\WinRM_Elevated_Shell.log: The
==> default: process cannot access the file 'C:\Windows\Temp\WinRM_Elevated_Shell.log' becau
==> default: se it is being used by another process.
==> default: At C:\tmp\vagrant-elevated-shell.ps1:19 char:6
==> default: + del <<<< $out_file
==> default: + CategoryInfo : WriteError: (C:\Windows\Temp\WinRM_Elevated_Shel
==> default: l.log:FileInfo) [Remove-Item], IOException
==> default: + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell
==> default: .Commands.RemoveItemCommand
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
powershell -ExecutionPolicy Bypass -OutputFormat Text -file c:\tmp\vagrant-shell.ps1
Stdout from the command:
Stderr from the command:
Remove-Item : Cannot remove item C:\Windows\Temp\WinRM_Elevated_Shell.log: The
process cannot access the file 'C:\Windows\Temp\WinRM_Elevated_Shell.log' becau
se it is being used by another process.
At C:\tmp\vagrant-elevated-shell.ps1:19 char:6
+ del <<<< $out_file
+ CategoryInfo : WriteError: (C:\Windows\Temp\WinRM_Elevated_Shel
l.log:FileInfo) [Remove-Item], IOException
+ FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell
.Commands.RemoveItemCommand
我需要確認的定界符版本的行爲:
config.vm.provision "shell", inline: <<-SCRIPT
regsvr32 foo/Foo.dll
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install foo -y
SCRIPT
,減少腳本的任何兩個命令,甚至只是echo
s:
config.vm.provision "shell", inline: "echo %COMPUTERNAME%"
config.vm.provision "shell", inline: "echo %COMPUTERNAME%"
你有沒有嘗試添加'-Force'在['流浪漢提升的-shell.ps1']的'$德爾聲明out_file'(https://github.com/mitchellh/vagrant/blob /master/plugins/communicators/winrm/scripts/elevated_shell.ps1.erb)腳本? –
我還沒有使用Vagrant的文件......我假設在'C:\ HashiCorp \ Vagrant'某處?我不確定這是一個錯誤,因此是SO問題,而不是GitHub問題:) –