@@ -34,8 +34,9 @@ $credential = New-Object -typename Pscredential -ArgumentList Administrator, $se
34
34
@ {ModuleName = ' xADCSDeployment' ;ModuleVersion = ' 1.0.0.0' }
35
35
36
36
# endregion
37
-
37
+ # region All Nodes
38
38
node $AllNodes.Where ({$true }).NodeName {
39
+ # endregion
39
40
# region LCM configuration
40
41
41
42
LocalConfigurationManager {
@@ -84,39 +85,19 @@ $credential = New-Object -typename Pscredential -ArgumentList Administrator, $se
84
85
# endregion
85
86
86
87
# region Firewall Rules
87
-
88
- xFirewall ' FPS-ICMP4-ERQ-In' {
89
- Name = ' FPS-ICMP4-ERQ-In'
90
- DisplayName = ' File and Printer Sharing (Echo Request - ICMPv4-In)'
91
- Description = ' Echo request messages are sent as ping requests to other nodes.'
92
- Direction = ' Inbound'
93
- Action = ' Allow'
94
- Enabled = ' True'
95
- Profile = ' Any'
96
- }
97
88
98
- xFirewall ' FPS-ICMP6-ERQ-In' {
99
- Name = ' FPS-ICMP6-ERQ-In' ;
100
- DisplayName = ' File and Printer Sharing (Echo Request - ICMPv6-In)'
101
- Description = ' Echo request messages are sent as ping requests to other nodes.'
102
- Direction = ' Inbound'
103
- Action = ' Allow'
104
- Enabled = ' True'
105
- Profile = ' Any'
106
- }
89
+ $LabData = Import-PowerShellDataFile .\* .psd1
90
+ $FireWallRules = $labdata.Allnodes.FirealllRuleNames
107
91
108
- xFirewall ' FPS-SMB-In-TCP' {
109
- Name = ' FPS-SMB-In-TCP'
110
- DisplayName = ' File and Printer Sharing (SMB-In)'
111
- Description = ' Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]'
112
- Direction = ' Inbound'
113
- Action = ' Allow'
92
+ foreach ($Rule in $FireWallRules ) {
93
+ xFirewall $Rule {
94
+ Name = $Rule.name
114
95
Enabled = ' True'
115
- Profile = ' Any'
116
96
}
117
- # endregion
97
+ } # End foreach
118
98
119
- } # end nodes ALL
99
+ } # end Firewall Rules
100
+ # endregion
120
101
121
102
# region Domain Controller config
122
103
@@ -290,6 +271,88 @@ $credential = New-Object -typename Pscredential -ArgumentList Administrator, $se
290
271
} # end DHCP Config
291
272
# endregion
292
273
274
+ # region Web config
275
+ node $AllNodes.Where ({$_.Role -eq ' Web' }).NodeName {
276
+
277
+ foreach ($feature in @ (
278
+ ' web-Server'
279
+
280
+ )) {
281
+ WindowsFeature $feature.Replace (' -' , ' ' ) {
282
+ Ensure = ' Present'
283
+ Name = $feature
284
+ IncludeAllSubFeature = $False
285
+ }
286
+ }
287
+
288
+ }# end Web Config
289
+ # endregion
290
+
291
+ # region DomainJoin config
292
+ node $AllNodes.Where ({$_.Role -eq ' DomainJoin' }).NodeName {
293
+
294
+ $DomainCredential = New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList (" $ ( $node.DomainName ) \$ ( $Credential.UserName ) " , $Credential.Password )
295
+
296
+ xWaitForADDomain DscForestWait {
297
+ DomainName = $Node.DomainName
298
+ DomainUserCredential = $DomainCredential
299
+ RetryCount = ' 20'
300
+ RetryIntervalSec = ' 60'
301
+ }
302
+
303
+ xComputer JoinDC {
304
+ Name = $Node.NodeName
305
+ DomainName = $Node.DomainName
306
+ Credential = $DomainCredential
307
+ DependsOn = ' [xWaitForADDomain]DSCForestWait'
308
+ }
309
+ }# end DomianJoin Config
310
+ # endregion
311
+
312
+ # region RSAT config
313
+ node $AllNodes.Where ({$_.Role -eq ' RSAT' }).NodeName {
314
+ # Adds RSAT
315
+
316
+ xHotfix RSAT {
317
+ Id = ' KB2693643'
318
+ Path = ' c:\Resources\WindowsTH-RSAT_WS2016-x64.msu'
319
+ Credential = $DomainCredential
320
+ DependsOn = ' [xcomputer]JoinDC'
321
+ Ensure = ' Present'
322
+ }
323
+
324
+ xPendingReboot Reboot {
325
+ Name = ' AfterRSATInstall'
326
+ DependsOn = ' [xHotFix]RSAT'
327
+ }
328
+
329
+
330
+ }# end RSAT Config
331
+
332
+ # region RDP config
333
+ node $AllNodes.Where ({$_.Role -eq ' RDP' }).NodeName {
334
+ # Adds RDP support and opens Firewall rules
335
+
336
+ Registry RDP {
337
+ Key = ' HKLM:\System\ControlSet001\Control\Terminal Server'
338
+ ValueName = ' fDenyTSConnections'
339
+ ValueType = ' Dword'
340
+ ValueData = ' 0'
341
+ Ensure = ' Present'
342
+ }
343
+ foreach ($Rule in @ (
344
+ ' RemoteDesktop-UserMode-In-TCP' ,
345
+ ' RemoteDesktop-UserMode-In-UDP' ,
346
+ ' RemoteDesktop-Shadow-In-TCP'
347
+ )) {
348
+ xFirewall $Rule {
349
+ Name = $Rule
350
+ Enabled = ' True'
351
+ DependsOn = ' [Registry]RDP'
352
+ }
353
+ } # End RDP
354
+ }
355
+ # endregion
293
356
# region ADCS
294
357
295
358
node $AllNodes.Where ({$_.Role -eq ' ADCS' }).NodeName {
@@ -687,63 +750,6 @@ $credential = New-Object -typename Pscredential -ArgumentList Administrator, $se
687
750
688
751
} # end ADCS Config
689
752
690
- # region Web config
691
- node $AllNodes.Where ({$_.Role -eq ' Web' }).NodeName {
692
-
693
- foreach ($feature in @ (
694
- ' web-Server'
695
-
696
- )) {
697
- WindowsFeature $feature.Replace (' -' , ' ' ) {
698
- Ensure = ' Present'
699
- Name = $feature
700
- IncludeAllSubFeature = $False
701
- }
702
- }
703
-
704
- }# end Web Config
705
- # endregion
706
-
707
- # region DomainJoin config
708
- node $AllNodes.Where ({$_.Role -eq ' DomainJoin' }).NodeName {
709
-
710
- $DomainCredential = New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList (" $ ( $node.DomainName ) \$ ( $Credential.UserName ) " , $Credential.Password )
711
-
712
- xWaitForADDomain DscForestWait {
713
- DomainName = $Node.DomainName
714
- DomainUserCredential = $DomainCredential
715
- RetryCount = ' 20'
716
- RetryIntervalSec = ' 60'
717
- }
718
-
719
- xComputer JoinDC {
720
- Name = $Node.NodeName
721
- DomainName = $Node.DomainName
722
- Credential = $DomainCredential
723
- DependsOn = ' [xWaitForADDomain]DSCForestWait'
724
- }
725
- }# end DomianJoin Config
726
- # endregion
727
-
728
- # region RSAT config
729
- node $AllNodes.Where ({$_.Role -eq ' RSAT' }).NodeName {
730
-
731
- xHotfix RSAT {
732
- Id = ' KB2693643'
733
- Path = ' c:\Resources\WindowsTH-RSAT_WS2016-x64.msu'
734
- Credential = $DomainCredential
735
- DependsOn = ' [xcomputer]JoinDC'
736
- Ensure = ' Present'
737
- }
738
-
739
- xPendingReboot Reboot {
740
- Name = ' AfterRSATInstall'
741
- DependsOn = ' [xHotFix]RSAT'
742
- }
743
-
744
-
745
- }# end RSAT Config
746
- # endregion
747
753
} # End AllNodes
748
754
# endregion
749
755
0 commit comments