From 4ed3be6a312d8af1046c76e095714612e7fcf7ab Mon Sep 17 00:00:00 2001 From: BJ Dierkes Date: Fri, 26 Feb 2016 15:40:27 -0600 Subject: [PATCH] Adding Windows Bootstrap Helper --- requirements-dev-windows.txt | 17 ++++++++ scripts/windows/bootstrap.ps1 | 75 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 requirements-dev-windows.txt create mode 100644 scripts/windows/bootstrap.ps1 diff --git a/requirements-dev-windows.txt b/requirements-dev-windows.txt new file mode 100644 index 00000000..986a7bde --- /dev/null +++ b/requirements-dev-windows.txt @@ -0,0 +1,17 @@ +# The following are only required in development, not production +nose +coverage +sphinx +pep8 +autopep8 +mock +sphinx_rtd_theme + +# Required for optional extensions +argcomplete +pystache +pyYaml +configobj +genshi +colorlog +tabulate diff --git a/scripts/windows/bootstrap.ps1 b/scripts/windows/bootstrap.ps1 new file mode 100644 index 00000000..e878d960 --- /dev/null +++ b/scripts/windows/bootstrap.ps1 @@ -0,0 +1,75 @@ +function Do-IEESC { + $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" + $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" + Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 + Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 + Stop-Process -Name Explorer + Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." ` + -ForegroundColor Green +} + +function Do-WinRM { + # Not sure if this can be improved? It's taken from + # https://learn.chef.io/manage-a-node/windows/bootstrap-your-node/ + + winrm quickconfig -q + winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' + winrm set winrm/config '@{MaxTimeoutms="1800000"}' + winrm set winrm/config/service '@{AllowUnencrypted="true"}' + winrm set winrm/config/service/auth '@{Basic="true"}' + + netsh advfirewall firewall add rule ` + name="WinRM 5985" ` + protocol=TCP ` + dir=in ` + localport=5985 ` + action=allow + netsh advfirewall firewall add rule ` + name="WinRM 5986" ` + protocol=TCP ` + dir=in ` + localport=5986 ` + action=allow + + net stop winrm + sc.exe config winrm start= auto + net start winrm + + Write-Host "WinRM setup complete" -ForegroundColor Green +} + +function Do-Python2 { + Invoke-WebRequest ` + -Uri https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi ` + -OutFile python2-installer.msi + + msiexec /i python2-installer.msi /passive ALLUSERS=1 TARGETDIR=C:\Python27 + + Start-Sleep -s 10 + + C:\Python27\Scripts\pip.exe install virtualenv + + Write-Host "Python2 setup complete" -ForegroundColor Green + +} + +function Do-Python3 { + Invoke-WebRequest ` + -Uri https://www.python.org/ftp/python/3.5.1/python-3.5.1-amd64.exe ` + -OutFile python3-installer.exe + + .\python3-installer.exe + + Start-Sleep -s 10 + + C:\Python35\Scripts\pip.exe install virtualenv + + Write-Host "Python3 setup complete" -ForegroundColor Green + +} + +Do-IEESC +Do-WinRM +Do-Python2 +Do-Python3 +Clear-History