none
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 "http://blogs.msdn.com/b/taylorb/archive/2013/08/12/attaching-a-vhd-to-a-vm-using-the-hyper-v-wmi-v2-namespace.aspx" 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.

    -Regards

    Rakesh

    Wednesday, October 30, 2013 10:16 AM