I'm currently working in C# consuming Hyper-V V2 WMI API to do different tasks related to virtual machines. I've not been able to figure out how to get/set VLAN ID. I've found many links on net pointing to PS HyperV lib exploring "Get-VMNICVLAN" and "Set-VMNICVLAN" but they dont seem to be working from me as Nic.connection[0] always seem to be null in my case. Perhaps that only works with Windows 2008 Hyper-V.
Also I'm not familiar with WMI scripts much so converting that code to C# is being a pain. Can someone please tell me exactly how to do so in C# using WMI.
Regards
Usman