@@ -652,6 +652,9 @@ If (-not $isAdmin) {
652652 New-item - type directory - Path " $mountdir \Windows\Panther" - force
653653 Copy-Item - Path $unattendfile - Destination " $mountdir \Windows\Panther\unattend.xml" - force
654654 Copy-Item - Path " $PSScriptRoot \Temp\DSC\*" - Destination " $mountdir \Program Files\WindowsPowerShell\Modules\" - Recurse - force
655+ WriteInfoHighlighted " `t Adding Hyper-V feature into DC"
656+ # Install Hyper-V feature
657+ Enable-WindowsOptionalFeature - FeatureName Microsoft- Hyper- V - Path " $mountdir "
655658
656659 # Create credentials for DSC
657660
@@ -682,9 +685,9 @@ If (-not $isAdmin) {
682685 Import-DSCResource - ModuleName NetworkingDSC - ModuleVersion " 9.0.0"
683686 Import-DSCResource - ModuleName xDHCPServer - ModuleVersion " 3.1.1"
684687 Import-DSCResource - ModuleName xPSDesiredStateConfiguration - ModuleVersion " 9.1.0"
688+ Import-DSCResource - ModuleName xHyper- V - ModuleVersion " 3.18.0"
685689 Import-DscResource - ModuleName PSDesiredStateConfiguration
686690
687-
688691 Node $AllNodes.Where {$_.Role -eq " Parent DC" }.Nodename
689692
690693 {
@@ -722,13 +725,23 @@ If (-not $isAdmin) {
722725 DependsOn = " [WindowsFeature]ADDSInstall"
723726 }
724727
725- WindowsFeature FeatureDNSTools
728+ WindowsFeature Hyper - V - PowerShell
726729 {
727730 Ensure = " Present"
728- Name = " RSAT-DNS-Server"
729- DependsOn = " [WindowsFeature]ADDSInstall"
730- }
731-
731+ Name = " Hyper-V-PowerShell"
732+ }
733+
734+ xVMSwitch VMSwitch
735+ {
736+ Ensure = " Present"
737+ Name = " vSwitch"
738+ Type = " External"
739+ AllowManagementOS = $true
740+ NetAdapterName = " Ethernet"
741+ EnableEmbeddedTeaming = $true
742+ DependsOn = " [WindowsFeature]Hyper-V-PowerShell"
743+ }
744+
732745 ADDomain FirstDS
733746 {
734747 DomainName = $Node.DomainName
@@ -842,9 +855,11 @@ If (-not $isAdmin) {
842855 IPaddress IP
843856 {
844857 IPAddress = ($DHCPscope + " 1/24" )
845- AddressFamily = ' IPv4'
846- InterfaceAlias = ' Ethernet'
858+ AddressFamily = " IPv4"
859+ InterfaceAlias = " vEthernet (vSwitch)"
860+ DependsOn = " [xVMSwitch]VMSwitch"
847861 }
862+
848863 WindowsFeature DHCPServer
849864 {
850865 Ensure = " Present"
@@ -866,7 +881,6 @@ If (-not $isAdmin) {
866881 DependsOn = " [WindowsFeature]DHCPServer"
867882 }
868883
869-
870884 xDhcpServerScope ManagementScope
871885 {
872886 Ensure = ' Present'
0 commit comments