Code: Select all
PS C:\> $vbox = New-Object -ComObject VirtualBox.VirtualBox
PS C:\> $vbox.Machines[6].Name
OtherTest64
PS C:\> $vbox.Machines[6].Unregister.OverloadDefinitions
SAFEARRAY(IMedium) Unregister (CleanupMode)
PS C:\> $vbox.Machines[6].DeleteConfig.OverloadDefinitions
IProgress DeleteConfig (SAFEARRAY(IMedium))
PS C:\> $vbox.Machines[6].DeleteConfig($vbox.Machines[6].Unregister(3))
Exception setting "DeleteConfig": Cannot convert the "System.Object[]" value of type "Object[]" to type "array".
At line:1 char:1
+ $vbox.Machines[6].DeleteConfig($vbox.Machines[6].Unregister(3))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : RuntimeException
I thought that maybe it was because the returned array was Null, so I attached 2 test disks to the test VM before running this. It unregisters the VM, but it won't delete the config or the disks.
Oddly, this whole process works fine if I run it from the web service. Does anyone have any idea what's wrong here?