diff --git a/Scripts/1_Prereq.ps1 b/Scripts/1_Prereq.ps1 index eada06ad..87823565 100644 --- a/Scripts/1_Prereq.ps1 +++ b/Scripts/1_Prereq.ps1 @@ -195,7 +195,7 @@ function Get-WindowsBuildNumber { #region Downloading required Posh Modules # Downloading modules into Temp folder if needed. - $modules=("ActiveDirectoryDsc","6.3.0"),("xDHCPServer","3.1.1"),("DnsServerDsc","3.0.0"),("NetworkingDSC","9.0.0"),("xPSDesiredStateConfiguration","9.1.0") + $modules=("ActiveDirectoryDsc","6.3.0"),("xDHCPServer","3.1.1"),("DnsServerDsc","3.0.0"),("NetworkingDSC","9.0.0"),("xPSDesiredStateConfiguration","9.1.0"),("xHyper-V","3.18.0") foreach ($module in $modules){ WriteInfoHighlighted "Testing if modules are present" $modulename=$module[0] diff --git a/Scripts/2_CreateParentDisks.ps1 b/Scripts/2_CreateParentDisks.ps1 index 55dfcaca..15e1526b 100644 --- a/Scripts/2_CreateParentDisks.ps1 +++ b/Scripts/2_CreateParentDisks.ps1 @@ -652,6 +652,9 @@ If (-not $isAdmin) { New-item -type directory -Path "$mountdir\Windows\Panther" -force Copy-Item -Path $unattendfile -Destination "$mountdir\Windows\Panther\unattend.xml" -force Copy-Item -Path "$PSScriptRoot\Temp\DSC\*" -Destination "$mountdir\Program Files\WindowsPowerShell\Modules\" -Recurse -force + WriteInfoHighlighted "`t Adding Hyper-V feature into DC" + #Install Hyper-V feature + Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V -Path "$mountdir" #Create credentials for DSC @@ -682,9 +685,9 @@ If (-not $isAdmin) { Import-DSCResource -ModuleName NetworkingDSC -ModuleVersion "9.0.0" Import-DSCResource -ModuleName xDHCPServer -ModuleVersion "3.1.1" Import-DSCResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion "9.1.0" + Import-DSCResource -ModuleName xHyper-V -ModuleVersion "3.18.0" Import-DscResource -ModuleName PSDesiredStateConfiguration - Node $AllNodes.Where{$_.Role -eq "Parent DC"}.Nodename { @@ -722,13 +725,23 @@ If (-not $isAdmin) { DependsOn = "[WindowsFeature]ADDSInstall" } - WindowsFeature FeatureDNSTools + WindowsFeature Hyper-V-PowerShell { Ensure = "Present" - Name = "RSAT-DNS-Server" - DependsOn = "[WindowsFeature]ADDSInstall" - } - + Name = "Hyper-V-PowerShell" + } + + xVMSwitch VMSwitch + { + Ensure = "Present" + Name = "vSwitch" + Type = "External" + AllowManagementOS = $true + NetAdapterName = "Ethernet" + EnableEmbeddedTeaming = $true + DependsOn = "[WindowsFeature]Hyper-V-PowerShell" + } + ADDomain FirstDS { DomainName = $Node.DomainName @@ -842,9 +855,11 @@ If (-not $isAdmin) { IPaddress IP { IPAddress = ($DHCPscope+"1/24") - AddressFamily = 'IPv4' - InterfaceAlias = 'Ethernet' + AddressFamily = "IPv4" + InterfaceAlias = "vEthernet (vSwitch)" + DependsOn = "[xVMSwitch]VMSwitch" } + WindowsFeature DHCPServer { Ensure = "Present" @@ -866,7 +881,6 @@ If (-not $isAdmin) { DependsOn = "[WindowsFeature]DHCPServer" } - xDhcpServerScope ManagementScope { Ensure = 'Present'