PowerShell
comment 1

Updates to Hyper-V Networking DSC Resource Modules

I just released an update to my Hyper-V Networking DSC resource module (version 2.6 at present). This module contains six resources at the moment and I plan to add a few more in the near future.

  • cVMSwitch is used to create virtual machine switches.
  • cSwitchEmbeddedTeam is used to create switch embedded team VM switches on Server 2014 TP4 and above.
  • cNatSwitch is used to deploy a VM switch of NAT type.
  • cVMNetworkAdapter is used to create VM network adapters to attach to either management OS or the virtual machines.
  • cVMNetworkAdapterSettings is used to configure VM network adapter settings such as bandwidth weights, port mirroring, DHCP guard, MAC address spoofing, etc.
  • cVMNetworkAdapterVlan is used to configure VLANs on virtual network adapters either in the management OS or virtual machines.

The cSwitchEmbeddedTeam and cNatSwitch resources are new in this release and are applicable only from Windows Server 2016 onwards.

The cVMNetworkAdapter, cVMNetworkAdapterVlan, and cVMNetworkAdapterSettings modules have two breaking changes.

  • There was no Id property earlier and the Name property was used as a key. This resulted in an issue where two different virtual machines cannot have a network adapter with the same name. DSC configuration compilation will complain that two or more resources have the same key property. The only workaround was to choose another key property. I thought about it and found no other property related to the VM Network adapter that we can set as a part of the DSC configuration process. Therefore, the new Id property is introduced. This is just a GUID and not tracked anywhere. This resolves DSC MOF compilation issues.
  • I removed ManagementOS (Boolean) property from the cVMNetworkAdapter, cVMNetworkAdapterVlan, and cVMNetworkAdapterSettings modules. Instead, the VMName property has been made mandatory. If you are adding or managing a network adapter that is attached to the management OS, you need to specify ‘Management OS’ as the value of VMName property. This change was necessary as the Get-DscConfiguration will not have a clue about getting the right adapter information if both ManagementOS and VMName properties are not mandatory. But it does not make sense to keep both of them mandatory so I decided to merge them together into VMName.

You can contribute or report bugs for any of these resources in my Github repository. These are available on PowerShell Gallery as well for you to download using the PackageManagement cmdlets.

There are a list of TODO items for this module:

  • Add Examples within the module folder.
  • Add Tests within the module folder.
  • Fix code based on the PowerShell Github repository coding / style guidelines for DSC resources.

Stay tuned for these updates and some more resources within this module.

 

Filed under: PowerShell

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.