Skip to content

Commit

Permalink
Added DSC for WAC
Browse files Browse the repository at this point in the history
  • Loading branch information
PlagueHO committed Sep 14, 2020
1 parent d3db42e commit 32fff34
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
for SA-AADC VM.
- `dsclibrary\MEMBER_AADC.DSC.ps1`: Created DSC config for deploying an
Azure AD Connect server.
- `dsclibrary\MEMBER_WAC.DSC.ps1`: Created DSC config for deploying a
Windows Administration Center server.

## [1.1.0] - 2020-08-30

Expand Down
71 changes: 71 additions & 0 deletions source/dsclibrary/MEMBER_WAC.DSC.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<###################################################################################################
DSC Template Configuration File For use by LabBuilder
.Title
MEMBER_WAC
.Desription
Builds a Server that is joined to a domain and then installs Windows Admin Center.
.Parameters:
DomainName = 'LABBUILDER.COM'
DomainAdminPassword = 'P@ssword!1'
DCName = 'SA-DC1'
PSDscAllowDomainUser = $true
WacSslCertThumbprint = '' # Thumbprint of the SSL Certificate to use the WAC site. If not specified will generate one.
Port = 6516 # The port number to install the WAC site on. If not specified will default to 6516
###################################################################################################>

Configuration MEMBER_WAC
{
Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0
Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 9.1.0

Node $AllNodes.NodeName {
# Assemble the Domain Admin Credential
if ($Node.DomainAdminPassword)
{
$domainAdminCredential = New-Object `
-TypeName System.Management.Automation.PSCredential `
-ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force))
}

$wacInstallArguments = '/qn /l*v c:\windows\temp\windowsadmincenter.msiinstall.log'

if ($null -ne $Node.Port) {
$wacInstallArguments = '{0} SME_PORT={1}' -f $wacInstallArguments, $Node.Port
}

if ([System.String]::IsNullOrEmpty($Node.WacSslCertThumbprint))
{
$wacInstallArguments = '{0} SSL_CERTIFICATE_OPTION=generate' -f $wacInstallArguments
}
else
{
$wacInstallArguments = '{0} SME_THUMBPRINT={1}' -f $wacInstallArguments, $Node.WacSslCertThumbprint
}

# Wait for the Domain to be available so we can join it.
WaitForAll DC
{
ResourceName = '[ADDomain]PrimaryDC'
NodeName = $Node.DCname
RetryIntervalSec = 15
RetryCount = 60
}

# Join this Server to the Domain
Computer JoinDomain
{
Name = $Node.NodeName
DomainName = $Node.DomainName
Credential = $domainAdminCredential
DependsOn = '[WaitForAll]DC'
}

xMsiPackage InstallWindowsAdminCenter
{
ProductId = '{4FAE3A2E-4369-490E-97F3-0B3BFF183AB9}'
Path = 'https://download.microsoft.com/download/1/0/5/1059800B-F375-451C-B37E-758FFC7C8C8B/WindowsAdminCenter1809.5.msi'
Arguments = $wacInstallArguments
Ensure = 'Present'
}
}
}
42 changes: 38 additions & 4 deletions source/samples/Sample_WS2019_AzureADConnect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<labbuilderconfig xmlns="labbuilderconfig"
name="Sample_WS2019_AzureADConnect"
version="1.0">
<description>Sample Windows Server 2019 Lab Configuration DC, DHCP, Edge and a Member for testing Azure AD Connect.</description>
<description>Sample Windows Server 2019 Lab Configuration DC, DHCP, Edge, a Windows Admin Center and a server for testing Azure AD Connect.</description>

<settings labid="LABBUILDER-AZUREADCONNECT.COM "
domainname="LABBUILDER-AZUREADCONNECT.COM"
Expand Down Expand Up @@ -127,16 +127,22 @@
IPAddress = '192.168.128.16';
AddressFamily = 'IPv4'
},
@{ Name = 'SA-EDGE1';
ScopeID = '192.168.128.0';
ClientMACAddress = '000000000003';
IPAddress = '192.168.128.19';
AddressFamily = 'IPv4'
},
@{ Name = 'SA-AADC';
ScopeID = '192.168.128.0';
ClientMACAddress = '000000000005';
ClientMACAddress = '000000000004';
IPAddress = '192.168.128.17';
AddressFamily = 'IPv4'
},
@{ Name = 'SA-EDGE1';
@{ Name = 'SA-WAC';
ScopeID = '192.168.128.0';
ClientMACAddress = '000000000005';
IPAddress = '192.168.128.19';
IPAddress = '192.168.128.18';
AddressFamily = 'IPv4'
}
)
Expand Down Expand Up @@ -222,6 +228,34 @@
dnsserver="fd53:ccc5:895a:bc00::a"/>
</adapter>
</adapters>
</vm>

<vm name="SA-WAC"
template="Template Windows Server 2019 Datacenter Full"
computername="SA-WAC"
bootorder="4">
<dsc configname="MEMBER_WAC"
configfile="MEMBER_WAC.DSC.ps1">
<parameters>
DomainName = "LABBUILDER.COM"
DomainAdminPassword = "P@ssword!1"
DCName = "SA-DC1"
PSDscAllowDomainUser = $true
</parameters>
</dsc>
<adapters>
<adapter name="Domain Private Site A"
switchname="Domain Private Site A">
<ipv4 address="192.168.128.17"
defaultgateway="192.168.128.18"
subnetmask="24"
dnsserver="192.168.128.10"/>
<ipv6 address="fd53:ccc5:895a:bc00::c"
defaultgateway="fd53:ccc5:895a:bc00::13"
subnetmask="64"
dnsserver="fd53:ccc5:895a:bc00::a"/>
</adapter>
</adapters>
</vm>
</vms>
</labbuilderconfig>

0 comments on commit 32fff34

Please sign in to comment.