Hi, I've encountered a problem with deleteConfig in Powershell. I am trying to remove all VM files with a code like this:
$vmMedia = $existingVM.unregister([vboxTypes.CleanupMode]::CleanupMode_DetachAllReturnHardDisksOnly.Value__) $vbProgress = $existingVM.deleteConfig($vmMedia) Unregister call works as expected and returns an array of valid IMedium objects. I can iterate through array items and access IMedium properties like $vmMedia[0].Location and so on. But deleteConfig fails with the following message: Assert failed on "DeleteConfig" with "1" argument(s): "Несовпадение типов. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))" The problem resembles the one described here: https://forums.virtualbox.org/viewtopic.php?f=34&t=61997 Basically, it seems that media parameter needs to be casted explicitly to an array of IMedium. But I cannot figure out how to do it. (IMedium[]$vmMedia) fails, which is expected - for this (possibly) to work we need fully qualified type name. I've read everything I could find about COM interfaces in Powershell but didn't find a solution. Maybe anyone can suggest something to try. At the moment I can work around this problem by calling VBoxManage utility with unregistervm and --delete. But it would be really nice to do everything through API. My VirtualBox version is 4.3.12 r93733 Tried on different hosts with Windows 7/8 x64 Professional I'm pretty sure it is a Powershell issue. I created a small VBS script which does exactly the same - it works as expected. Best regards, Alexey Orlov _______________________________________________ vbox-dev mailing list [email protected] https://www.virtualbox.org/mailman/listinfo/vbox-dev
