Hi,
I am trying to set up a DSC resource to deploy a Hyper-V Converged virtual network using this as a guide (Using DSC to deploy Hyper-V converged virtual network – Creating a host team (Part 1)). However this does set the networking/DNS properties of the NIC Team - this is not something I want to do manually as it would defeat the object of DSC (and I need to set a specific IP address). My research has lead me to here (https://www.penflip.com/powershellorg/the-dsc-book/blob/master/writing-a-custom-dsc-resource.txt) - Writing Composite DSC Resources.
Individually, both work as they should - create the NIC team, then set the IPv4 & DNS settings. However, if I try to combine them I get the following error:
PSDesiredStateConfiguration\Node : The module 'CommonConfig' could not be loaded. For more information, run 'Import-Module CommonConfig'. At line:6 char:5 + Node Localhost { + ~~~~ + CategoryInfo : ObjectNotFound: (CommonConfig\CommonConfig:String) [PSDesiredStateConfiguration\node], ParentContainsErrorRecordException + FullyQualifiedErrorId : CouldNotAutoLoadModule,PSDesiredStateConfiguration\node Errors occurred while processing configuration 'HyperVConvergedNet'. At C:\windows\system32\windowspowershell\v1.0\Modules\PSDesiredStateConfiguration\PSDesiredStateConfiguration.psm1:2223 char:5 + throw $errorRecord + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (HyperVConvergedNet:String) [], InvalidOperationException + FullyQualifiedErrorId : FailToProcessConfiguration
Configuration HyperVConvergedNet { Import-DscResource -Module cWindowsOS -Name cNetworkTeam Import-DscResource -ModuleName CommonConfigModule # Create Network Team named HostTeam adding all NICs as members Node Localhost { cNetworkTeam NetworkTeam { Name = 'HostTeam' TeamingMode = 'SwitchIndependent' LoadBalancingAlgorithm = 'HyperVPort' TeamMembers = 'NIC1','NIC2','NIC3','NIC4' Ensure = 'Present' } # Assign an IP address to HostTeam CommonConfig Common { IPAddress = "192.168.192.202" DependsOn = '[cNetworkTeam]NetworkTeam' } } }
Any help appreciated, thanks
Tony