PowerShell Server: Unable to execute Virtual Box commands.


Problem Description

When attempting to manage Virtual Box VMs from the PowerShell Server prompt, the user may see the following error:

.\VBoxManage.exe : VBoxManage.exe: error: Could not find a registered machine named 'CentOS-6.4-i386-Gnome' At line:1 char:1 + .\VBoxManage.exe startvm CentOS-6.4-i386-Gnome + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (VBoxManage.exe:...6.4-i386-Gnome' :String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError VBoxManage.exe: error: Details: code VBOX_E_OBJECT_NOT_FOUND (0x80bb0001), component VirtualBox, interface IVirtualBox, callee IUnknown VBoxManage.exe: error: Context: "FindMachine(Bstr(pszVM).raw(), machine.asOutParam())" at line 575 of file VBoxManageMisc.cpp

Cause

There appears to be an issue with the sharing of Virtual Box’s internal registry of VMs in remote sessions. Due to this issue, any VMs previously registered in a local session or another remote session are not recognized as registered VMs.

Solution

The solution to this issue is quite simple. All that is needed is to register the VM in the PowerShell Server session. Once this is done you will again be able to manage the Virtual Box VM. Please see the example below:

PS> .\vboxmanage.exe registervm "C:\Users\myUser\VirtualBox VMs\test\test.vbox" PS> .\vboxmanage.exe startvm test --type headless

Note: When registering the VM, the user must specify the full path to the VM’s .vbox file.

Note 2: The “–type headless” parameter in the Start VM command indicates that the VM will be started silently with no user interaction. See: VirtualBox Manual: vboxmanage startvn

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.