[vbox-dev] PowerShell with the COM API and enums usage

Olivier Cochard-Labbé olivier at cochard.me
Wed Aug 10 09:53:21 PDT 2011

Hi all,

I'm looking for using the VirtualBox COM API enums type with PowerShell.
As example, I want to add a SATA controller to a virtual machine
(object is called "$vm" in my example).
I'm using this line:
$vm_obj_storage_ctrl = $vm_obj.addStorageController("SATA Controller",2)

But referring to the COM API Manual, I can use the enums type
"StorageBus" in place of my hard-coder "2".
How to use this enums type in PowerShell ?
I would like to replace my old line by a new one like this:
$vm_storage_ctrl = $vm.addStorageController("SATA Controller",StorageBus::SATA)



More information about the vbox-dev mailing list