How can i create virtual iSCSI controller with hyper-v wmi api using C#?


Can anyone help me with creating virtual iSCSI controller and assigning it to virtual machine using WMI? I need it because I want to create virtual machine with controller attached to it. As far as I can understand this issue i need to create iscsi setting
data, but I can’t find any reference on which wmi class to use? This is what I am trying to do and It’s not working :

ManagementClass scsiClass =
   new ManagementClass(@"rootvirtualizationv2:Msvm_SCSIProtocolController");

ManagementObject scsiData = scsiClass.CreateInstance();

string[] resourceSettings = new string[3];
// Memory settings.
resourceSettings[0] = memorySettingData.GetText(TextFormat.CimDtd20);
// Processor settings. 
 resourceSettings[1] = processorSettingData.GetText(TextFormat.CimDtd20);
// Add SCSI
 resourceSettings[2] = scsiData.GetText(TextFormat.CimDtd20);

If I remove "scsiData" then virtual machine creates successfully, any help please?

Documentation :

I need to use C#, I can not use powershell…

Read full post . . . .

Go Que Newsroom Categories

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 40 bytes) in /home/content/36/8658336/html/goquecom/wp-includes/wp-db.php on line 1889