# IIS SETUP FOR UMS Web # Created for inLogic A/S @ 2017 # By KHM # # Last edit: TOD 08/01/2022 # # Version: 1 # $text = @" _____ _____ _____ _____ _ _ _____ _______ _ _ ______ _____ |_ _|_ _|/ ____| |_ _| \ | |/ ____|__ __|/\ | | | | | ____| __ \ | | | | | (___ | | | \| | (___ | | / \ | | | | | |__ | |__) | | | | | \___ \ | | | . ` |\___ \ | | / /\ \ | | | | | __| | _ / _| |_ _| |_ ____) | _| |_| |\ |____) | | |/ ____ \| |____| |____| |____| | \ \ |_____|_____|_____/ |_____|_| \_|_____/ |_/_/ \_\______|______|______|_| \_\ _ __ _ ___ ______ (_)__ / / ___ ___ _(_)___ / _ | _/_/ __/ / / _ \/ /__/ _ \/ _ `/ / __/ / __ |_/_/_\ \ /_/_//_/____/\___/\_, /_/\__/ /_/ |_/_/ /___/ /___/ "@ function w2022() { # Need console installed aswell #Array of modules to install [System.Collections.ArrayList]$iismodules = @() #WebServer $iismodules.Add('Web-Server') #Initial Webserver selection #Common HTTP Features $iismodules.Add('Web-Default-Doc') #Default Document $iismodules.Add('Web-Dir-Browsing') #Directory Browsing $iismodules.Add('Web-Http-Errors') #HTTP Errors $iismodules.Add('Web-Static-Content') #Static Content $iismodules.Add('Web-Http-Redirect') #HTTP Redirection #Health and Diagnostics $iismodules.Add('Web-Http-Logging') #HTTP Logging $iismodules.Add('Web-Log-Libraries') #Logging Tools $iismodules.Add('Web-Request-Monitor') #Request Monitor #Performance $iismodules.Add('Web-Stat-Compression') #Static Content Compression #Security $iismodules.Add('Web-Filtering') #Request Filtering $iismodules.Add('Web-Basic-Auth') #Basic Authentication $iismodules.Add('Web-CertProvider') #Centralized SSL Certificate Support $iismodules.Add('Web-Client-Auth') #Client Certificate Mapping Authentication $iismodules.Add('Web-Digest-Auth') #Digest Authentication $iismodules.Add('Web-Cert-Auth') #IIS Client Certificate Mapping Authentication $iismodules.Add('Web-IP-Security') #IP and Domain Restrictions $iismodules.Add('Web-Url-Auth') #URL Authorization $iismodules.Add('Web-Windows-Auth') #Windows Authentication #Application development $iismodules.Add('Web-Net-Ext45') #.NET Extensibility 4.5 $iismodules.Add('Web-Asp-Net45') #ASP.NET 4.5 $iismodules.Add('Web-Includes') #Server Side Includes $iismodules.Add('Web-WebSockets') #Websockets protocol used for new razor stuff #Management Tools# $iismodules.Add('Web-Mgmt-Compat') #IIS 6 Management Compatibility $iismodules.Add('Web-Metabase') #IIS 6 Metabase Compatibility $iismodules.Add('Web-Lgcy-Mgmt-Console') #IIS 6 Management Console $iismodules.Add('Web-Lgcy-Scripting') #IIS 6 Scripting Tools $iismodules.Add('Web-WMI') #IIS 6 WMI Compatibility $iismodules.Add('Web-Scripting-Tools ') #IIS Management Scripts and Tools $iismodules.Add('Web-Mgmt-Service') #Management Service $iismodules.Add('Web-Mgmt-Console') #Management Console #IncludeAllSubFeature# $installCommand = "Install-WindowsFeature -Name " foreach ($module in $iismodules) { $installCommand += $module + ", " } $installCommand = $installCommand.TrimEnd(",", " ") $installCommand = $installCommand + @" Set-Service -Name aspnet_state -StartupType 'automatic' Start-Service -Name aspnet_state "@ $installCommand = $ExecutionContext.InvokeCommand.NewScriptBlock($installCommand) & $installCommand } function w2019() { # Need console installed aswell #Array of modules to install [System.Collections.ArrayList]$iismodules = @() #WebServer $iismodules.Add('Web-Server') #Initial Webserver selection #Common HTTP Features $iismodules.Add('Web-Default-Doc') #Default Document $iismodules.Add('Web-Dir-Browsing') #Directory Browsing $iismodules.Add('Web-Http-Errors') #HTTP Errors $iismodules.Add('Web-Static-Content') #Static Content $iismodules.Add('Web-Http-Redirect') #HTTP Redirection #Health and Diagnostics $iismodules.Add('Web-Http-Logging') #HTTP Logging $iismodules.Add('Web-Log-Libraries') #Logging Tools $iismodules.Add('Web-Request-Monitor') #Request Monitor #Performance $iismodules.Add('Web-Stat-Compression') #Static Content Compression #Security $iismodules.Add('Web-Filtering') #Request Filtering $iismodules.Add('Web-Basic-Auth') #Basic Authentication $iismodules.Add('Web-CertProvider') #Centralized SSL Certificate Support $iismodules.Add('Web-Client-Auth') #Client Certificate Mapping Authentication $iismodules.Add('Web-Digest-Auth') #Digest Authentication $iismodules.Add('Web-Cert-Auth') #IIS Client Certificate Mapping Authentication $iismodules.Add('Web-IP-Security') #IP and Domain Restrictions $iismodules.Add('Web-Url-Auth') #URL Authorization $iismodules.Add('Web-Windows-Auth') #Windows Authentication #Application development $iismodules.Add('Web-Net-Ext45') #.NET Extensibility 4.5 $iismodules.Add('Web-Asp-Net45') #ASP.NET 4.5 $iismodules.Add('Web-Includes') #Server Side Includes $iismodules.Add('Web-WebSockets') #Websockets protocol used for new razor stuff #Management Tools# $iismodules.Add('Web-Mgmt-Compat') #IIS 6 Management Compatibility $iismodules.Add('Web-Metabase') #IIS 6 Metabase Compatibility $iismodules.Add('Web-Lgcy-Mgmt-Console') #IIS 6 Management Console $iismodules.Add('Web-Lgcy-Scripting') #IIS 6 Scripting Tools $iismodules.Add('Web-WMI') #IIS 6 WMI Compatibility $iismodules.Add('Web-Scripting-Tools ') #IIS Management Scripts and Tools $iismodules.Add('Web-Mgmt-Service') #Management Service $iismodules.Add('Web-Mgmt-Console') #Management Console #IncludeAllSubFeature# $installCommand = "Install-WindowsFeature -Name " foreach ($module in $iismodules) { $installCommand += $module + ", " } $installCommand = $installCommand.TrimEnd(",", " ") $installCommand = $installCommand + @" Set-Service -Name aspnet_state -StartupType 'automatic' Start-Service -Name aspnet_state "@ $installCommand = $ExecutionContext.InvokeCommand.NewScriptBlock($installCommand) & $installCommand } function w2016() { # Need console installed aswell #Array of modules to install [System.Collections.ArrayList]$iismodules = @() #WebServer $iismodules.Add('Web-Server') #Initial Webserver selection #Common HTTP Features $iismodules.Add('Web-Default-Doc') #Default Document $iismodules.Add('Web-Dir-Browsing') #Directory Browsing $iismodules.Add('Web-Http-Errors') #HTTP Errors $iismodules.Add('Web-Static-Content') #Static Content $iismodules.Add('Web-Http-Redirect') #HTTP Redirection #Health and Diagnostics $iismodules.Add('Web-Http-Logging') #HTTP Logging $iismodules.Add('Web-Log-Libraries') #Logging Tools $iismodules.Add('Web-Request-Monitor') #Request Monitor #Performance $iismodules.Add('Web-Stat-Compression') #Static Content Compression #Security $iismodules.Add('Web-Filtering') #Request Filtering $iismodules.Add('Web-Basic-Auth') #Basic Authentication $iismodules.Add('Web-CertProvider') #Centralized SSL Certificate Support $iismodules.Add('Web-Client-Auth') #Client Certificate Mapping Authentication $iismodules.Add('Web-Digest-Auth') #Digest Authentication $iismodules.Add('Web-Cert-Auth') #IIS Client Certificate Mapping Authentication $iismodules.Add('Web-IP-Security') #IP and Domain Restrictions $iismodules.Add('Web-Url-Auth') #URL Authorization $iismodules.Add('Web-Windows-Auth') #Windows Authentication #Application development $iismodules.Add('Web-Net-Ext45') #.NET Extensibility 4.5 $iismodules.Add('Web-Asp-Net45') #ASP.NET 4.5 $iismodules.Add('Web-Includes') #Server Side Includes $iismodules.Add('Web-WebSockets') #Websockets protocol used for new razor stuff #Management Tools# $iismodules.Add('Web-Mgmt-Compat') #IIS 6 Management Compatibility $iismodules.Add('Web-Metabase') #IIS 6 Metabase Compatibility $iismodules.Add('Web-Lgcy-Mgmt-Console') #IIS 6 Management Console $iismodules.Add('Web-Lgcy-Scripting') #IIS 6 Scripting Tools $iismodules.Add('Web-WMI') #IIS 6 WMI Compatibility $iismodules.Add('Web-Scripting-Tools ') #IIS Management Scripts and Tools $iismodules.Add('Web-Mgmt-Service') #Management Service $iismodules.Add('Web-Mgmt-Console') #Management Console #IncludeAllSubFeature# $installCommand = "Install-WindowsFeature -Name " foreach ($module in $iismodules) { $installCommand += $module + ", " } $installCommand = $installCommand.TrimEnd(",", " ") $installCommand = $installCommand + @" Set-Service -Name aspnet_state -StartupType 'automatic' Start-Service -Name aspnet_state "@ $installCommand = $ExecutionContext.InvokeCommand.NewScriptBlock($installCommand) & $installCommand } Write-Host $text Write-Host "By KHM @ InLogic A/S" $os = (Get-WmiObject -class Win32_OperatingSystem).Caption if ($os -like "*2016*") { w2016 } elseif ($os -like "*2019*") { w2019 } elseif ($os -like "*2022*") { w2022 } else { w2022 }