POWERSHELL 52
IIS WSP 2.2 Guest on 19th February 2019 06:42:38 PM
  1. ###########################
  2. ### IIS Web Server Prepare
  3. ### Version: 2.2
  4. ###########################
  5.  
  6.  
  7. ###########################
  8. ### Check if admin
  9. ###########################
  10. If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
  11.     [Security.Principal.WindowsBuiltInRole] "Administrator"))
  12. {
  13.     Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
  14.     Break
  15. }
  16.  
  17.  
  18. ###########################
  19. ### Download Choco
  20. ###########################
  21. Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  22.  
  23.  
  24. ###########################
  25. ### Choco for generic servers
  26. ###########################
  27. 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 vcredist2005 vcredist2008 vcredist2010 gsmartcontrol vcredist2012 s3put hijackthis virustotaluploader pci-z lessmsi cmder wsus-offline-update hashtab opera dotnet4.7 aspnetmvc4.install
  28.  
  29.  
  30. ###########################
  31. ### # Disable IPv6 from registry
  32. ###########################
  33. New-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\' -Name  'DisabledComponents' -Value '0xffffffff' -PropertyType 'DWord'
  34.  
  35.  
  36. ###########################
  37. ### Enable Task Scheduler history (requires restart)
  38. ###########################
  39. $logName = 'Microsoft-Windows-TaskScheduler/Operational'
  40. $log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
  41. $log.IsEnabled=$true
  42. $log.SaveChanges()
  43.  
  44.  
  45. ###########################
  46. ### Choco for IIS servers
  47. ###########################
  48. choco install -y --ignore-checksums iiscrypto webdeploy webpicmd
  49.  
  50.  
  51. ###########################
  52. ### Install IIS features
  53. ###########################
  54. # Dotnet 2.0, 3.0, 3.5, 4.6
  55. # Telnet and WAS
  56. # IIS and WebDAV
  57. $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"
  58. Install-WindowsFeature -Name $IISFeatures -IncludeAllSubFeature
  59. $FeaturesToRemove = "Web-Ftp-Server","Web-Ftp-Service","Web-Ftp-Ext"
  60. Uninstall-WindowsFeature -Name $FeaturesToRemove
  61. WebPICMD.exe /Install /Products:MVC2 /AcceptEula /SuppressReboot
  62. WebPICMD.exe /Install /Products:MVC3Runtime /AcceptEula /SuppressReboot
  63. WebPICMD.exe /Install /Products:UrlRewrite2 /AcceptEula /SuppressReboot
  64. choco install -y dotnetcore-sdk
  65.  
  66. ###########################
  67. ### Remove default IIS apps
  68. ###########################
  69. Remove-Website -Name "Default Web Site"
  70. $defaultAppPools = @(".NET v2.0",".NET v2.0 Classic",".NET v4.5",".NET v4.5 Classic","Classic .NET AppPool","DefaultAppPool")
  71. Foreach ($defaultAppPool in $defaultAppPools){
  72.     IF (Test-path "IIS:\AppPools\$defaultAppPool"){Remove-WebAppPool -name $DefaultAppPool}
  73. }
  74.  
  75.  
  76. ###########################
  77. ### Change IIS log location
  78. ###########################
  79. #$NewFolders = "inetpub", "inetpub\apps", "logs"
  80. #$NewFolders | ForEach-Object {New-Item E:\$_ -type directory}
  81. #Import-Module WebAdministration
  82. #Set-WebConfigurationProperty "/system.applicationHost/sites/siteDefaults" -name logfile.directory -value E:\logs
  83.  
  84.  
  85. ###########################
  86. ### Activate Windows license in AWS
  87. ###########################
  88. Set-ExecutionPolicy Unrestricted -force
  89.  PowerShell -Command "& {Import-Module C:\ProgramData\Amazon\EC2-Windows\Launch\Module\Ec2Launch.psm1 ; Add-Routes}"
  90. slmgr /ato
  91.  
  92.  
  93.  
  94. ###########################
  95. ### Disable Windows autoupdates
  96. ###########################
  97. New-Item HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name WindowsUpdate
  98. New-Item HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name AU
  99. New-ItemProperty HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU -Name NoAutoUpdate -Value 1
  100.  
  101.  
  102. ###########################
  103. ### Rename Computer
  104. ###########################
  105. $temp_Date = Get-Date -UFormat "%H%d%m%Y"
  106. Rename-Computer -NewName "IIS-$temp_Date"
  107.  
  108. ###########################
  109. ### Make the required restart
  110. ###########################
  111. #Restart-Computer -Force

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

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

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

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