Problem with VBoxManage guestcontrol and powershell
Posted: 13. Feb 2012, 15:01
Hi,
I have a strange behaviour here when trying to execute a powershell command on my guest system using VBoxManage... Hope you can help me.
My goal is to remotely trigger the execution of different scripts on my guest VM and get their stdout and stderr. This works great for arbitrary scripts, e.g. when I execute ipconfig in a cmd shell like
then the remote command executes, returns and I get the output in the same shell like
Perfect and exactly what I need so far. However, as soon as I execute a powershell script, e.g. the following very minimalistic one:
and call it via
what happens is:
I definitely need the command on the host system to return and I also definitely need the redirected stdout on the host!
Any ideas? I cannot solve out what is the big difference in remote executing a command like ipconfig and a powershell script.
My setup is as follows:
Host: W7 64Bit, Virtual Box V 4.1.0 r73009
Guest: Windows Server 2008 R2 Standard
Best regards,
Stefan
I have a strange behaviour here when trying to execute a powershell command on my guest system using VBoxManage... Hope you can help me.
My goal is to remotely trigger the execution of different scripts on my guest VM and get their stdout and stderr. This works great for arbitrary scripts, e.g. when I execute ipconfig in a cmd shell like
Code: Select all
VBoxManage.exe guestcontrol "ExampleVM" execute --username administrator --password xxx --wait-exit --wait-stdout --image "C:\Windows\System32\ipconfig.exe"Code: Select all
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe guestcontrol "ExampleVM" execute --username administrator --password xxx --wait-exit --wait-stdout --image "C:\Windows\System32\ipconfig.exe"
Windows IP Configuration
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 10.1.1.12
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
C:\Program Files\Oracle\VirtualBox>Code: Select all
Write-Host "Hello!"Code: Select all
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe guestcontrol ExampleVM" execute --username administrator --password xxx --wait-exit --wait-stdout --image "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -- C:\TemplateSW.ps1- 1) On the guest system a cmd opens in which obviously the script is executed
2) I see the output "Hello!" in the shell on my host system.
3) On the guest system the cmd stays open and in the Task Manager I see the powershell process staying alive
4) On my host system, the VBoxManage.exe never returns. Only if I manually close the cmd shell in the guest, the command in the host returns.
(Of Course, if I execute the powershell script directly on the guest, it returns as expected)
I definitely need the command on the host system to return and I also definitely need the redirected stdout on the host!
Any ideas? I cannot solve out what is the big difference in remote executing a command like ipconfig and a powershell script.
My setup is as follows:
Host: W7 64Bit, Virtual Box V 4.1.0 r73009
Guest: Windows Server 2008 R2 Standard
Best regards,
Stefan