bootstrap.ps1 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. function Do-IEESC {
  2. $AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
  3. $UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
  4. Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
  5. Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
  6. Stop-Process -Name Explorer
  7. Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." `
  8. -ForegroundColor Green
  9. }
  10. function Do-WinRM {
  11. # Not sure if this can be improved? It's taken from
  12. # https://learn.chef.io/manage-a-node/windows/bootstrap-your-node/
  13. winrm quickconfig -q
  14. winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}'
  15. winrm set winrm/config '@{MaxTimeoutms="1800000"}'
  16. winrm set winrm/config/service '@{AllowUnencrypted="true"}'
  17. winrm set winrm/config/service/auth '@{Basic="true"}'
  18. netsh advfirewall firewall add rule `
  19. name="WinRM 5985" `
  20. protocol=TCP `
  21. dir=in `
  22. localport=5985 `
  23. action=allow
  24. netsh advfirewall firewall add rule `
  25. name="WinRM 5986" `
  26. protocol=TCP `
  27. dir=in `
  28. localport=5986 `
  29. action=allow
  30. net stop winrm
  31. sc.exe config winrm start= auto
  32. net start winrm
  33. Write-Host "WinRM setup complete" -ForegroundColor Green
  34. }
  35. function Do-Python2 {
  36. Invoke-WebRequest `
  37. -Uri https://www.python.org/ftp/python/2.7.11/python-2.7.11.amd64.msi `
  38. -OutFile python2-installer.msi
  39. msiexec /i python2-installer.msi /passive ALLUSERS=1 TARGETDIR=C:\Python27
  40. Start-Sleep -s 10
  41. C:\Python27\Scripts\pip.exe install virtualenv
  42. Write-Host "Python2 setup complete" -ForegroundColor Green
  43. }
  44. function Do-Python3 {
  45. Invoke-WebRequest `
  46. -Uri https://www.python.org/ftp/python/3.5.1/python-3.5.1-amd64.exe `
  47. -OutFile python3-installer.exe
  48. .\python3-installer.exe
  49. Start-Sleep -s 10
  50. C:\Python35\Scripts\pip.exe install virtualenv
  51. Write-Host "Python3 setup complete" -ForegroundColor Green
  52. }
  53. Do-IEESC
  54. Do-WinRM
  55. Do-Python2
  56. Do-Python3
  57. Clear-History