Attaching a VHD To A VM Using The Hyper-V WMI V2 Namespace RRS feed

  • Question

  • Hi Ben ,

     I am trying to convert the WMI script at the link "" to c# equivalent.

    However I got stucked at one point

    #The PartComponent is the Default Msvm_StorageAllocationSettingData class values $Msvm_StorageAllocationSettingDataTemplate = [WMI]$Msvm_SettingsDefineCapabilities.PartComponent

    $Msvm_SettingsDefineCapabilities.PartComponent gives the string object and

    How to convert it to WMI management object in c# .Because an explicit cast gives

    the illegal cast exception.

    Thanks in advance.



    Wednesday, October 30, 2013 10:16 AM