Last active
September 13, 2017 22:10
-
-
Save bertvv/964e0cd00f38b12a438ae509373a3fc5 to your computer and use it in GitHub Desktop.
Basic configuration Windows Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ConfigureWindowsServer.ps1 -- Basic configuration Windows Server 2012R2 | |
# Enable Ansible Remoting | |
$scriptPath = ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1')) | |
Invoke-Command -ScriptBlock ([scriptblock]::Create($scriptPath)) -ArgumentList "-Verbose -SkipNetworkProfileCheck -CertValidityDays 2492" | |
# Allow Ping | |
Get-NetFirewallRule -DisplayName "*Echo Request*" | Set-NetFirewallRule -enabled true | |
# Enable Remote Desktop | |
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null | |
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null | |
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true | |
# Enable Windows SmartScreen | |
Set-ItemProperty -Path Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name "SmartScreenEnabled" -Value "RequireAdmin" | |
# Disable Shutdown Event Tracker | |
New-ItemProperty -Force -Path Registry::HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Reliability -Name "ShutdownReasonUI" -PropertyType DWord -Value 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment