From 48804a4758f18686928bb1907c0869d0124e25b2 Mon Sep 17 00:00:00 2001 From: DemitasseNZ Date: Sun, 17 Apr 2016 18:53:31 +1200 Subject: [PATCH] Remote shutdown of Windows 2012 Servers View servers have firewall enabled. Needed to allow remote management through for shutdown script to work --- Build/Automate/CS1/Build.ps1 | 3 +++ Build/Automate/CS2/Build.ps1 | 3 +++ Build/Automate/DC/Phase2.ps1 | 4 ++++ Build/Automate/SS/Build.ps1 | 3 +++ Build/Automate/ShutLab.ps1 | 2 +- 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Build/Automate/CS1/Build.ps1 b/Build/Automate/CS1/Build.ps1 index ee70104..0f6536a 100644 --- a/Build/Automate/CS1/Build.ps1 +++ b/Build/Automate/CS1/Build.ps1 @@ -25,6 +25,9 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 Write-BuildLog "Install admin tools" Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter + Write-BuildLog "Enable remote management through firewall" + Netsh firewall set service RemoteAdmin + Netsh advfirewall set currentprofile settings remotemanagement enable } $Files = get-childitem "b:\view$viewinstall" for ($i=0; $i -lt $files.Count; $i++) { diff --git a/Build/Automate/CS2/Build.ps1 b/Build/Automate/CS2/Build.ps1 index aa333d8..9a052c6 100644 --- a/Build/Automate/CS2/Build.ps1 +++ b/Build/Automate/CS2/Build.ps1 @@ -24,6 +24,9 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 Write-BuildLog "Install admin tools" Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter + Write-BuildLog "Enable remote management through firewall" + Netsh firewall set service RemoteAdmin + Netsh advfirewall set currentprofile settings remotemanagement enable } if (Test-Path "C:\VMware-view*") { $Files = get-childitem "C:\" diff --git a/Build/Automate/DC/Phase2.ps1 b/Build/Automate/DC/Phase2.ps1 index 57bb5d4..10d04db 100644 --- a/Build/Automate/DC/Phase2.ps1 +++ b/Build/Automate/DC/Phase2.ps1 @@ -368,6 +368,8 @@ dnscmd localhost /RecordAdd lab.local Host4 A 192.168.199.14 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local CS1 A 192.168.199.33 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local CS2 A 192.168.199.34 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local SS A 192.168.199.35 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local v1 A 192.168.199.36 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local vbr A 192.168.199.37 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local DC2 A 192.168.201.4 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local VC2 A 192.168.201.5 >> C:\DNS.log dnscmd localhost /RecordAdd lab.local Host11 A 192.168.201.11 >> C:\DNS.log @@ -383,6 +385,8 @@ dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 14 PTR Host4.lab.local >> C dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 33 PTR cs1.lab.local >> C:\DNS.log dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 34 PTR cs2.lab.local >> C:\DNS.log dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 35 PTR SS.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 36 PTR v1.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 37 PTR vbr.lab.local >> C:\DNS.log dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 4 PTR DC2.lab.local >> C:\DNS.log dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 5 PTR VC2.lab.local >> C:\DNS.log dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 11 PTR Host11.lab.local >> C:\DNS.log diff --git a/Build/Automate/SS/Build.ps1 b/Build/Automate/SS/Build.ps1 index 8d67efa..82bf11d 100644 --- a/Build/Automate/SS/Build.ps1 +++ b/Build/Automate/SS/Build.ps1 @@ -24,6 +24,9 @@ If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environm set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 Write-BuildLog "Install admin tools" Add-WindowsFeature RSAT-Feature-Tools,RSAT-DHCP,RSAT-DNS-Server,RSAT-AD-AdminCenter + Write-BuildLog "Enable remote management through firewall" + Netsh firewall set service RemoteAdmin + Netsh advfirewall set currentprofile settings remotemanagement enable } $Files = get-childitem "b:\view$viewinstall" for ($i=0; $i -lt $files.Count; $i++) { diff --git a/Build/Automate/ShutLab.ps1 b/Build/Automate/ShutLab.ps1 index 36468f6..dc36176 100644 --- a/Build/Automate/ShutLab.ps1 +++ b/Build/Automate/ShutLab.ps1 @@ -36,7 +36,7 @@ If ([string]::Compare($ReBuild, "Y", $True) -eq "0"){ exit } } - Write-host "Connect to Linux amchiunes to cache RSA Keys, say yes to all" + Write-host "Connect to Linux machines to cache RSA Keys, say yes to all" $ping = new-object System.Net.NetworkInformation.Ping $Reply = $ping.send("192.168.199.254") if ($Reply.status –eq "Success") {