Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit ab1ca8e

Browse files
author
Jason Helmick
committed
Update with Windows10
From Jeff Hicks
1 parent 48e2f28 commit ab1ca8e

File tree

5 files changed

+426
-0
lines changed

5 files changed

+426
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Lab definition
2+
3+
This lab builds the following:
4+
5+
* 1 Workgroup joined Windows 10 Client with RSAT tools installed.
6+
7+
It will also create a local user account with a password of `P@ssw0rd` using same name as the person running the configuration. In other words, it will use the value of `$env:username`.
8+
9+
## To get started:
10+
11+
To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab:
12+
PS> Unattend-Lab
13+
14+
To run the commands individually to setup the lab environment:
15+
16+
Run the following for initial setup:
17+
PS> Setup-Lab
18+
19+
To start the LAb, and apply configurations the first time:
20+
PS> Run-Lab
21+
22+
To enable Internet access for the VM's, run:
23+
PS> Enable-Internet
24+
25+
To validate when configurations have converged:
26+
PS> Validate-Lab
27+
28+
Once validation is complete you should connect to the VM, logon as the non-administrator account and let Windows 10 finish setting up. Then restart the computer applying any pending updates. After this you can, and should, snapshot the VM.
29+
30+
## To Stop and snapshot the lab
31+
32+
To stop the lab VM's:
33+
PS> Shutdown-lab
34+
35+
To checkpoint the VM's:
36+
PS> Snapshot-Lab
37+
38+
To quickly rebuild the labs from the checkpoint, run:
39+
PS> Refresh-Lab
40+
41+
## To remove a lab
42+
43+
To destroy the lab to build again:
44+
PS> Wipe-Lab

Configurations/Windows10/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Jeff Hicks
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
#requires -version 5.0
2+
3+
<# Notes:
4+
5+
Authors: Jason Helmick and Melissa (Missy) Januszko
6+
7+
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko and Jason Helmick.
8+
Currently on her public DSC hub located here: https://github.com/majst32/DSC_public.git
9+
10+
Additional contributors of note: Jeff Hicks
11+
12+
13+
Disclaimer
14+
15+
This example code is provided without copyright and AS IS. It is free for you to use and modify.
16+
Note: These demos should not be run as a script. These are the commands that I use in the
17+
demonstrations and would need to be modified for your environment.
18+
19+
#>
20+
21+
Configuration AutoLab {
22+
23+
$LabData = Import-PowerShellDataFile -Path .\VMConfigurationData.psd1
24+
$Secure = ConvertTo-SecureString -String "$($labdata.allnodes.labpassword)" -AsPlainText -Force
25+
$credential = New-Object -typename Pscredential -ArgumentList Administrator, $secure
26+
27+
Import-DscResource -ModuleName "PSDesiredStateConfiguration" -ModuleVersion "1.1"
28+
Import-DscResource -ModuleName "xPSDesiredStateConfiguration" -ModuleVersion "5.0.0.0"
29+
Import-DscResource -ModuleName "xComputerManagement" -ModuleVersion "1.8.0.0"
30+
Import-DscResource -ModuleName "xNetworking" -ModuleVersion "3.0.0.0"
31+
Import-DscResource -ModuleName "xWindowsUpdate" -ModuleVersion "2.5.0.0"
32+
Import-DscResource -ModuleName "xPendingReboot" -ModuleVersion "0.3.0.0"
33+
34+
Node $AllNodes.Where({$true}).NodeName {
35+
xComputer ComputerName {
36+
Name = $Node.NodeName
37+
WorkGroupName = "Lab"
38+
}
39+
user Administrator {
40+
UserName = "Administrator"
41+
Disabled = $false
42+
Password = $credential
43+
PasswordChangeRequired = $false
44+
PasswordNeverExpires = $True
45+
}
46+
47+
#create a local account with the same name as the person
48+
#running this config
49+
user $env:username {
50+
UserName = $env:username
51+
Disabled = $false
52+
Password = $credential
53+
PasswordChangeRequired = $false
54+
PasswordNeverExpires = $True
55+
}
56+
57+
#add the user to the local Administrators group
58+
group Administrators {
59+
GroupName = "Administrators"
60+
MembersToInclude = $env:username
61+
DependsOn = "[user]$($env:username)"
62+
}
63+
64+
#force a reboot after completing everything
65+
xPendingReboot Complete {
66+
Name = "Post-Config Reboot"
67+
SkipPendingComputerRename = $True
68+
DependsOn = @("[group]Administrators","[xComputer]ComputerName","[user]Administrator")
69+
}
70+
71+
#region LCM configuration
72+
LocalConfigurationManager {
73+
RebootNodeIfNeeded = $true
74+
AllowModuleOverwrite = $true
75+
ConfigurationMode = 'ApplyOnly'
76+
}
77+
#endregion
78+
79+
#region IPaddress settings
80+
If (-not [System.String]::IsNullOrEmpty($node.IPAddress)) {
81+
xIPAddress 'PrimaryIPAddress' {
82+
IPAddress = $node.IPAddress
83+
InterfaceAlias = $node.InterfaceAlias
84+
PrefixLength = $node.SubnetMask
85+
AddressFamily = $node.AddressFamily
86+
}
87+
88+
If (-not [System.String]::IsNullOrEmpty($node.DefaultGateway)) {
89+
xDefaultGatewayAddress 'PrimaryDefaultGateway' {
90+
InterfaceAlias = $node.InterfaceAlias
91+
Address = $node.DefaultGateway
92+
AddressFamily = $node.AddressFamily
93+
}
94+
}
95+
96+
If (-not [System.String]::IsNullOrEmpty($node.DnsServerAddress)) {
97+
xDnsServerAddress 'PrimaryDNSClient' {
98+
Address = $node.DnsServerAddress
99+
InterfaceAlias = $node.InterfaceAlias
100+
AddressFamily = $node.AddressFamily
101+
}
102+
}
103+
104+
If (-not [System.String]::IsNullOrEmpty($node.DnsConnectionSuffix)) {
105+
xDnsConnectionSuffix 'PrimaryConnectionSuffix' {
106+
InterfaceAlias = $node.InterfaceAlias
107+
ConnectionSpecificSuffix = $node.DnsConnectionSuffix
108+
}
109+
}
110+
} #End IF
111+
112+
#endregion
113+
114+
#region Firewall Rules
115+
116+
$FireWallRules = $labdata.Allnodes.FirewallRuleNames
117+
118+
foreach ($Rule in $FireWallRules) {
119+
xFirewall $Rule {
120+
Name = $Rule
121+
Enabled = 'True'
122+
}
123+
} #End foreach
124+
}
125+
#endregion
126+
127+
#region RSAT config
128+
node $AllNodes.Where({$_.Role -eq 'RSAT'}).NodeName {
129+
# Adds RSAT
130+
131+
xHotfix RSAT {
132+
Id = 'KB2693643'
133+
Path = 'c:\Resources\WindowsTH-RSAT_WS2016-x64.msu'
134+
Ensure = 'Present'
135+
}
136+
137+
} #end RSAT Config
138+
139+
#region RDP config
140+
node $AllNodes.Where({$_.Role -eq 'RDP'}).NodeName {
141+
# Adds RDP support and opens Firewall rules
142+
143+
Registry RDP {
144+
Key = 'HKLM:\System\ControlSet001\Control\Terminal Server'
145+
ValueName = 'fDenyTSConnections'
146+
ValueType = 'Dword'
147+
ValueData = '0'
148+
Ensure = 'Present'
149+
}
150+
foreach ($Rule in @(
151+
'RemoteDesktop-UserMode-In-TCP',
152+
'RemoteDesktop-UserMode-In-UDP',
153+
'RemoteDesktop-Shadow-In-TCP'
154+
)) {
155+
xFirewall $Rule {
156+
Name = $Rule
157+
Enabled = 'True'
158+
DependsOn = '[Registry]RDP'
159+
}
160+
} # End RDP
161+
}
162+
#endregion
163+
}
164+
165+
AutoLab -OutputPath .\ -ConfigurationData .\VMConfigurationData.psd1
166+
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<# Notes:
2+
3+
Disclaimer
4+
5+
This example code is provided without copyright and AS IS. It is free for you to use and modify.
6+
Note: These demos should not be run as a script. These are the commands that I use in the
7+
demonstrations and would need to be modified for your environment.
8+
9+
#>
10+
11+
@{
12+
AllNodes = @(
13+
@{
14+
NodeName = '*'
15+
16+
# Lab Password - assigned to Administrator and Users
17+
LabPassword = 'P@ssw0rd'
18+
PSDscAllowPlainTextPassword = $true
19+
PSDscAllowDomainUser = $true
20+
21+
# Common networking
22+
InterfaceAlias = 'Ethernet'
23+
DefaultGateway = '192.168.3.1'
24+
SubnetMask = 24
25+
AddressFamily = 'IPv4'
26+
IPNetwork = '192.168.3.0/24'
27+
IPNatName = 'LabNat'
28+
DnsServerAddress = '8.8.8.8'
29+
30+
# Firewall settings to enable
31+
FirewallRuleNames = @(
32+
'FPS-ICMP4-ERQ-In';
33+
'FPS-ICMP6-ERQ-In';
34+
'FPS-SMB-In-TCP'
35+
)
36+
37+
# Lability default node settings
38+
Lability_SwitchName = 'LabNet'
39+
Lability_ProcessorCount = 1
40+
Lability_MinimumMemory = 1GB
41+
SecureBoot = $false
42+
Lability_Media = '2016_x64_Standard_Core_EN_Eval' # Can be Core,Win10,2012R2,nano
43+
# 2016_x64_Standard_EN_Eval
44+
# 2016_x64_Standard_Core_EN_Eval
45+
# 2016_x64_Datacenter_EN_Eval
46+
# 2016_x64_Datacenter_Core_EN_Eval
47+
# 2016_x64_Standard_Nano_EN_Eval
48+
# 2016_x64_Datacenter_Nano_EN_Eval
49+
# 2012R2_x64_Standard_EN_Eval
50+
# 2012R2_x64_Standard_EN_V5_Eval
51+
# 2012R2_x64_Standard_Core_EN_Eval
52+
# 2012R2_x64_Standard_Core_EN_V5_Eval
53+
# 2012R2_x64_Datacenter_EN_V5_Eval
54+
# WIN10_x64_Enterprise_EN_Eval
55+
}
56+
57+
<# Available Roles for computers
58+
DC = Domain Controller
59+
DHCP = Dynamic Host Configuration Protocol
60+
ADCS = Active Directory Certificate SErvices - plus autoenrollment GPO's and DSC and web server certs
61+
Web = Basic web server
62+
RSAT = Remote Server Administration Tools for the client
63+
RDP = enables RDP and opens up required firewall rules
64+
DomainJoin = joins a computer to the domain
65+
#>
66+
67+
@{
68+
NodeName = 'Win10Ent'
69+
IPAddress = '192.168.3.101'
70+
Role = @('RSAT', 'RDP')
71+
Lability_ProcessorCount = 2
72+
Lability_MinimumMemory = 2GB
73+
Lability_Media = 'WIN10_x64_Enterprise_EN_Eval'
74+
Lability_BootOrder = 20
75+
Lability_timeZone = 'Central Standard Time' #[System.TimeZoneInfo]::GetSystemTimeZones()
76+
Lability_Resource = @('Win10RSAT')
77+
CustomBootStrap = @'
78+
# To enable PSRemoting on the client
79+
Enable-PSRemoting -SkipNetworkProfileCheck -Force;
80+
'@
81+
}
82+
);
83+
NonNodeData = @{
84+
Lability = @{
85+
# EnvironmentPrefix = 'PS-GUI-' # this will prefix the VM names
86+
Media = (
87+
@{
88+
## This media is a replica of the default '2016_x64_Standard_Nano_EN_Eval' media
89+
## with the additional 'Microsoft-NanoServer-DSC-Package' package added.
90+
Id = '2016_x64_Standard_Nano_DSC_EN_Eval';
91+
Filename = '2016_x64_EN_Eval.iso';
92+
Description = 'Windows Server 2016 Standard Nano 64bit English Evaluation';
93+
Architecture = 'x64';
94+
ImageName = 'Windows Server 2016 SERVERSTANDARDNANO';
95+
MediaType = 'ISO';
96+
OperatingSystem = 'Windows';
97+
Uri = 'http://download.microsoft.com/download/1/6/F/16FA20E6-4662-482A-920B-1A45CF5AAE3C/14393.0.160715-1616.RS1_RELEASE_SERVER_EVAL_X64FRE_EN-US.ISO';
98+
Checksum = '18A4F00A675B0338F3C7C93C4F131BEB';
99+
CustomData = @{
100+
SetupComplete = 'CoreCLR';
101+
PackagePath = '\NanoServer\Packages';
102+
PackageLocale = 'en-US';
103+
WimPath = '\NanoServer\NanoServer.wim';
104+
Package = @(
105+
'Microsoft-NanoServer-Guest-Package',
106+
'Microsoft-NanoServer-DSC-Package'
107+
)
108+
}
109+
}
110+
) # Custom media additions that are different than the supplied defaults (media.json)
111+
Network = @( # Virtual switch in Hyper-V
112+
@{ Name = 'LabNet'; Type = 'Internal'; NetAdapterName = 'Ethernet'; AllowManagementOS = $true;}
113+
);
114+
DSCResource = @(
115+
## Download published version from the PowerShell Gallery or Github
116+
@{ Name = 'xComputerManagement'; RequiredVersion = '1.8.0.0'; Provider = 'PSGallery'; },
117+
@{ Name = 'xNetworking'; RequiredVersion = '3.0.0.0'; Provider = 'PSGallery'; },
118+
@{ Name = 'xWindowsUpdate' ; RequiredVersion = '2.5.0.0'; Provider = 'PSGallery';},
119+
@{ Name = 'xPSDesiredStateConfiguration'; RequiredVersion = '5.0.0.0'; Provider = 'PSGallery'},
120+
@{ Name = 'xPendingReboot'; RequiredVersion = '0.3.0.0'; Provider = 'PSGallery'}
121+
);
122+
Resource = @(
123+
@{
124+
Id = 'Win10RSAT'
125+
Filename = 'WindowsTH-RSAT_WS2016-x64.msu'
126+
Uri = 'https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS2016-x64.msu'
127+
Expand = $false
128+
#DestinationPath = '\software' # Default is resources folder
129+
}
130+
);
131+
};
132+
};
133+
};

0 commit comments

Comments
 (0)