Skip to content
⌘ NSIS Forum Archive

NSIS and VBoxManage.exe

17 posts

butsay#

NSIS and VBoxManage.exe

Hello everybody.
NSIS 2.51
When I run: ExecWait '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm my_vm'
it works.
When I run: ExecWait '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms'
It doesn't work.
If I run both strings in MS Windows command line , both of them work just fine.
What is the difference?
Thank you.
Anders#
And doesn't work means what exactly? If this command writes to stdout and you want that output you need to use nsExec or one of the other "DOS" exec plugins...
Afrow UK#
!include x64.nsh
${DisableX64FSRedirection}

Or use the ExecDos plug-in with the /disablefsr switch.

Stu
Anders#
Originally Posted by Afrow UK View Post
!include x64.nsh
${DisableX64FSRedirection}

Or use the ExecDos plug-in with the /disablefsr switch.
How could WOW64 redirection be the issue if the first command worked correctly
Afrow UK#
Perhaps he is running the 2nd command from a page callback and has only disabled redirection in a Section. VirtualBox is a 64-bit install on 64-bit Windows so it's good to cover all bases and the user may not have disabled redirection at all (and is testing on a 32-bit OS) 🙂

Stu
butsay#
Thank you for your respond.
In my first example :ExecWait '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm my_vm' it sends the command to VM and I can see in the terminal windows how the command was executed.
In my second example :ExecWait '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms'
it does nothing. It just opens the terminal window and waits for a few second and exits. It doesn't list VMS.
butsay#
Originally Posted by Afrow UK View Post
!include x64.nsh
${DisableX64FSRedirection}

Or use the ExecDos plug-in with the /disablefsr switch.

Stu
It didn't help to solve the problem.
butsay#
When I need to run : list vms, I have to use the following :
ExecWait 'cmd.exe /k "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms'
I had to add cmd.exe, because it didn't work without it.
But if I run:
ExecWait 'cmd.exe /k "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms'
It still doesn't return anything.
Anders#
Section
nsExec::ExecToLog '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms'
Pop $0
SectionEnd 
works for me on 64-bit Windows 8.

Hardcoding ProgramFiles like this is of course not something you should do!
butsay#
It works if I run it directly in MS Windows cmd:
C:\Program Files\Oracle\VirtualBox>VboxManage list runningvms
"rnd" {cf185132-d834-4f3e897c6aa3811b9972}
But it still doesn't work with NSIS:
ExecWait 'cmd.exe /k "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list runningvms'
butsay#
Originally Posted by Anders View Post
Section
nsExec::ExecToLog '"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" list vms'
Pop $0
SectionEnd 
works for me on 64-bit Windows 8.

Hardcoding ProgramFiles like this is of course not something you should do!
Please try to do the same but for: list runningvms
butsay#
Originally Posted by butsay View Post
Please try to do the same but for: list runningvms
It works for : list vms
but it doesn't work for: list runningvms
butsay#edited
When I run the command:
nsExec::ExecToLog 'cmd.exe /k "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" guestcontrol rnd --username root --password ******* run .........
I've got this output:
VBoxManage.exe: error: Machine "rnd" is not running (currently powered off)!
D:\VirtualBox>
Completed

So the problem is that the state of the virtual machine is not detected.
And this is why I can't get anything from the command : list runningvms
My questions is what should I do to detect properly the state of the virtual machine in NSIS?
It works just fine in the MS command line window.
Anders#
Does your installer request UAC elevation? I think I read something about VBox not listing VMs for other users and possibly other logon sessions.
butsay#
No, my installer doesn't request UAC elevation.
Unfortunately NSIS doesn't work properly with VboxManage.exe
I was able to run all my commands with Vboxmanage using bat file but not the ExecWait, ExecDos e.t.c.