application-workloads/active-directory/active-directory-new-domain-ha-2-dc-zones/DSC/PrepareADBDC.ps1 (56 lines of code) (raw):
configuration PrepareADBDC
{
param
(
[Parameter(Mandatory)]
[String]$DNSServer,
[Int]$RetryCount=20,
[Int]$RetryIntervalSec=30
)
Import-DscResource -ModuleName xStorage, xNetworking
$Interface=Get-NetAdapter|Where Name -Like "Ethernet*"|Select-Object -First 1
$InterfaceAlias=$($Interface.Name)
Node localhost
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
}
xWaitforDisk Disk2
{
DiskNumber = 2
RetryIntervalSec =$RetryIntervalSec
RetryCount = $RetryCount
}
xDisk ADDataDisk
{
DiskNumber = 2
DriveLetter = "F"
DependsOn = "[xWaitForDisk]Disk2"
}
WindowsFeature ADDSInstall
{
Ensure = "Present"
Name = "AD-Domain-Services"
}
WindowsFeature ADDSTools
{
Ensure = "Present"
Name = "RSAT-ADDS-Tools"
DependsOn = "[WindowsFeature]ADDSInstall"
}
WindowsFeature ADAdminCenter
{
Ensure = "Present"
Name = "RSAT-AD-AdminCenter"
DependsOn = "[WindowsFeature]ADDSTools"
}
xDnsServerAddress DnsServerAddress
{
Address = $DNSServer
InterfaceAlias = $InterfaceAlias
AddressFamily = 'IPv4'
DependsOn="[WindowsFeature]ADDSInstall"
}
}
}