Answered by:
How can i create virtual iSCSI controller with hyper-v wmi api?

Question
-
Hello,
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(@"root\virtualization\v2: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?
Edit : I need to use C#, powershell is not an option.
Documentation : https://docs.microsoft.com/en-us/windows/desktop/hyperv_v2/windows-virtualization-portal- Moved by Wendy ZangMicrosoft contingent staff Friday, March 15, 2019 5:16 AM
- Edited by kbarto Friday, March 15, 2019 9:41 AM Didn't specify that powershell is not an option
Thursday, March 14, 2019 7:51 PM
Answers
-
I would ask here:
https://social.technet.microsoft.com/Forums/en-us/home?forum=winserverhyperv
Richard Mueller - MVP Enterprise Mobility (Identity and Access)
- Proposed as answer by Dave PatrickMVP Friday, March 15, 2019 1:03 PM
- Marked as answer by Dave PatrickMVP Friday, March 22, 2019 12:01 AM
Friday, March 15, 2019 11:49 AM -
I'd also try asking over here.
https://social.msdn.microsoft.com/Forums/en-US/home?forum=csharpgeneral
https://social.msdn.microsoft.com/Forums/en-US/home?forum=windowsgeneraldevelopmentissues
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Dave PatrickMVP Monday, March 18, 2019 3:31 PM
- Marked as answer by Dave PatrickMVP Friday, March 22, 2019 12:01 AM
Saturday, March 16, 2019 10:56 PM
All replies
-
Hi kbarto,
Thank you for posting here.
For your question is more related to Hyper-V, this forum is not support that. I will move it to Where is the forum for to find the suitable place.
Best Regards,
Wendy
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Friday, March 15, 2019 5:16 AM -
Sorry for misplacing post.Friday, March 15, 2019 9:40 AM
-
Will do, tnx!Saturday, March 16, 2019 9:17 PM
-
I'd also try asking over here.
https://social.msdn.microsoft.com/Forums/en-US/home?forum=csharpgeneral
https://social.msdn.microsoft.com/Forums/en-US/home?forum=windowsgeneraldevelopmentissues
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Dave PatrickMVP Monday, March 18, 2019 3:31 PM
- Marked as answer by Dave PatrickMVP Friday, March 22, 2019 12:01 AM
Saturday, March 16, 2019 10:56 PM