POWERSHELL 42
Iis pos Guest on 1st October 2019 04:02:32 PM
  1. ###########################
  2. ### Download Choco
  3. ###########################
  4. Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  5.  
  6.  
  7. ###########################
  8. ### Choco for generic servers
  9. ###########################
  10. choco install -y --ignore-checksums chocolatey chocolatey-core.extension chocolatey-windowsupdate.extension chocolateygui notepadplusplus.install 7zip.install putty.install sysinternals procexp curl windirstat autoruns latencymon openhardwaremonitor processhacker.install cpu-z gpu-z lockhunter pstools wget openssl.light keystore-explorer.portable filezilla bginfo wireshark nmap bleachbit vcredist-all gsmartcontrol vcredist2012 s3put hijackthis virustotaluploader pci-z lessmsi cmder wsus-offline-update hashtab opera dotnet4.7 aspnetmvc4.install aspnetmvc2 bulk-crap-uninstaller cyberduck googlechrome
  11.  
  12.  
  13. ###########################
  14. ### Enable Task Scheduler history (requires restart)
  15. ###########################
  16. $logName = 'Microsoft-Windows-TaskScheduler/Operational'
  17. $log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
  18. $log.IsEnabled=$true
  19. $log.SaveChanges()
  20.  
  21.  
  22. ###########################
  23. ### Choco for IIS servers
  24. ###########################
  25. choco install -y --ignore-checksums iiscrypto webdeploy webpicmd
  26.  
  27.  
  28. ###########################
  29. ### Install IIS features
  30. ###########################
  31. # IIS, WebDAV, Telnet, WAS, NETFrameworks etc
  32. $IISFeatures = "WebDAV-Redirector","WAS","Telnet-Client","Web-WHC","NET-Framework-Features","NET-Framework-45-Features","Web-Mgmt-Console","Web-Scripting-Tools","Web-Mgmt-Service","Web-Server"
  33. Install-WindowsFeature -Name $IISFeatures -IncludeAllSubFeature
  34. #WebPICMD.exe /Install /Products:MVC2 /AcceptEula /SuppressReboot
  35. WebPICMD.exe /Install /Products:MVC3Runtime /AcceptEula /SuppressReboot
  36. WebPICMD.exe /Install /Products:UrlRewrite2 /AcceptEula /SuppressReboot
  37. WebPICMD.exe /Install /Products:ApplicationRequestRouting /AcceptEula /SuppressReboot
  38. choco install -y dotnetcore-sdk
  39.  
  40. ###########################
  41. ### Install DEVOPS01 Features
  42. ###########################
  43. $DEVOPS01 = "FS-FileServer", "File-Service"
  44. Install-WindowsFeature -Name $DEVOPS01 -IncludeAllSubFeature
  45.  
  46.  
  47.  
  48. ###########################
  49. ### Remove default IIS apps
  50. ###########################
  51. Remove-Website -Name "Default Web Site"
  52. $defaultAppPools = @(".NET v2.0",".NET v2.0 Classic",".NET v4.5",".NET v4.5 Classic","Classic .NET AppPool","DefaultAppPool")
  53. Foreach ($defaultAppPool in $defaultAppPools){
  54.     IF (Test-path "IIS:\AppPools\$defaultAppPool"){Remove-WebAppPool -name $DefaultAppPool}
  55. }
  56.  
  57.  
  58. ###########################
  59. ### Disable IIS logging
  60. ###########################
  61. $dontLog = (get-WebConfigurationProperty -PSPath "IIS:\" -filter "system.webServer/httpLogging" -name dontLog).Value
  62. set-WebConfigurationProperty -PSPath "IIS:\" -filter "system.webServer/httpLogging" -name dontLog -value $true
  63. $dontLog = (get-WebConfigurationProperty -PSPath "IIS:\" -filter "system.webServer/httpLogging" -name dontLog).Value
  64.  
  65.  
  66. ###########################
  67. ### Change IIS log location
  68. ###########################
  69. #$NewFolders = "inetpub", "inetpub\apps", "logs"
  70. #$NewFolders | ForEach-Object {New-Item E:\$_ -type directory}
  71. #Import-Module WebAdministration
  72. #Set-WebConfigurationProperty "/system.applicationHost/sites/siteDefaults" -name logfile.directory -value E:\logs
  73.  
  74.  
  75. ###########################
  76. ### Disable Windows autoupdates
  77. ###########################
  78. New-Item HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name WindowsUpdate
  79. New-Item HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name AU
  80. New-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name NoAutoUpdate -Value 1
  81.  
  82.  
  83. ###########################
  84. ### Pariplay Firewall rules
  85. ###########################
  86. # Information website
  87. New-NetFirewallrule -displayname Pariplay.Information -direction inbound -action allow -protocol tcp -LocalPort 42001
  88. # Health check website
  89. New-NetFirewallrule -DisplayName Pariplay.Health -Direction inbound -Action allow -Protocol tcp -LocalPort 42002-42020
  90.  
  91.  
  92. ###########################
  93. ### Remove password expiration for Administrator
  94. ###########################
  95. Enable-LocalUser -Name "Administrator"
  96. Set-LocalUser -Name Administrator -PasswordNeverExpires $true -AccountNeverExpires
  97.  
  98.  
  99. ###########################
  100. ### Make the required restart
  101. ###########################
  102. Restart-Computer -Force

RSO cPaste е място за публикуване на код или текст за по-лесно отстраняване на грешки.

Влез или се Регистрай за да редактираш, изтриваш или преглеждаш хронология на твоето публикувано съдържание

Необработен текст

Влез или се Регистрирай за да редактираш или задържиш това съдържание.