Function InitializeHostStyle { #changing the Background Color, foreground Color, window title and window size. Clear-Host $WindowSize = $Host.UI.RawUI.WindowSize $WindowSize.Width = 80 $WindowSize.Height = 25 try{ $Host.UI.RawUI.WindowSize = $WindowSize } catch [System.Management.Automation.SetValueInvocationException] { $Maxvalue = ($_.Exception.Message |Select-String "\d+").Matches[0].Value $WindowSize.Height = $Maxvalue $Host.UI.RawUI.WindowSize = $WindowSize } $host.ui.RawUI.ForegroundColor = "black" $host.ui.RawUI.BackgroundColor= "White" $host.ui.RawUI.WindowTitle = "AspenTech installer" Write-Host "AspenTech Installer." -ForegroundColor BLACK Write-Host "Getting System Ready. Please wait..." -ForegroundColor BLACK } Function GetFeatureState { param( [string]$FeatureName = $(Read-Host -prompt "Feature Name") ) #cd $env:TEMP # change current working folder to TEMP, and use DISM.exe from there $FeatureInfo = @(DISM /online /Get-FeatureInfo /featurename:$FeatureName /English) #always displays command-line output in English Write-Host "" -ForegroundColor BLACK Write-Host "Feature Name: $FeatureName" -ForegroundColor BLACK For ($i=0; $i -lt $FeatureInfo.Length; $i++) { if ($FeatureInfo[$i] -eq "State : Enabled") { return "State : Enabled" } if ($FeatureInfo[$i] -eq "State : Enable Pending") { return "State : Enable Pending" } if ($FeatureInfo[$i] -eq "State : Disabled") { return "State : Disabled" } if ($FeatureInfo[$i] -eq "State : Disable Pending") { return "State : Disable Pending" } } Write-Host $FeatureInfo Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") } Function EnableFeature { param( [string]$FeatureName = $(Read-Host -prompt "Feature Name"), [string]$PrereqID = $(Read-Host -prompt "PreRequisite ID") ) $FeatureState = GetFeatureState($FeatureName) if ($FeatureState -eq "State : Disabled") # Install Feature { #cd $env:TEMP # change current working folder to TEMP, and use DISM.exe from there if([Environment]::OSVersion.Version.Major -eq "6" -and [Environment]::OSVersion.Version.Minor -eq "1") { DISM /online /enable-feature /norestart /featurename:$FeatureName } else { DISM /online /enable-feature /all /norestart /featurename:$FeatureName } $FeatureState = GetFeatureState($FeatureName) } if ($FeatureState -eq "State : Enable Pending") # Write the pending reboot prereq ID into RunOnce key, so that IDK can take it as passed. { $KeyPath = "" if ($env:PROCESSOR_ARCHITECTURE -eq "x86") { $KeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" } else { $KeyPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce" } $KeyValue = (Get-ItemProperty -Path $KeyPath).AspenRebootPending if ($KeyValue -eq $null) { new-ItemProperty -Path $KeyPath -Name AspenRebootPending -Value $PrereqID } elseif (!$KeyValue.Contains($PrereqID)) { $KeyValue = $KeyValue + "," + $PrereqID Set-ItemProperty -Path $KeyPath -Name AspenRebootPending -Value $KeyValue } return $FeatureState } if ($FeatureState -ne "State : Enabled"){ Write-Host $FeatureState Write-Host "" Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") return $FeatureState } return $FeatureState } Function DisableFeature { param( [string]$FeatureName = $(Read-Host -prompt "Feature Name"), [string]$PrereqID = $(Read-Host -prompt "PreRequisite ID") ) $FeatureState = GetFeatureState($FeatureName) if ($FeatureState -eq "State : Enabled") # Install Feature { #cd $env:TEMP # change current working folder to TEMP, and use DISM.exe from there DISM /online /disable-feature /norestart /featurename:$FeatureName $FeatureState = GetFeatureState($FeatureName) } if ($FeatureState -eq "State : Disable Pending") # Write the pending reboot prereq ID into RunOnce key, so that IDK can take it as passed. { $KeyPath = "" if ($env:PROCESSOR_ARCHITECTURE -eq "x86") { $KeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" } else { $KeyPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\RunOnce" } $KeyValue = (Get-ItemProperty -Path $KeyPath).AspenRebootPending if ($KeyValue -eq $null) { new-ItemProperty -Path $KeyPath -Name AspenRebootPending -Value $PrereqID } elseif (!$KeyValue.Contains($PrereqID)) { $KeyValue = $KeyValue + "," + $PrereqID Set-ItemProperty -Path $KeyPath -Name AspenRebootPending -Value $KeyValue } return $FeatureState } if ($FeatureState -ne "State : Disabled"){ Write-Host $FeatureState Write-Host "" Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") return $FeatureState } return $FeatureState } ############################################################################################################################ # Functions can be called to enable each separate windows feature ############################################################################################################################ Function EnableREQ_MSMQ { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_MSMQ" EnableFeature "MSMQ-Container" $PrereqID EnableFeature "MSMQ-Server" $PrereqID EnableFeature "MSMQ-Triggers" $PrereqID EnableFeature "MSMQ-ADIntegration" $PrereqID EnableFeature "MSMQ-HTTP" $PrereqID EnableFeature "MSMQ-Multicast" $PrereqID EnableFeature "MSMQ-DCOMProxy" $PrereqID } Function EnableREQ_TCP_Activation { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_TCP_Activation" EnableFeature "WAS-WindowsActivationService" $PrereqID EnableFeature "WAS-ProcessModel" $PrereqID EnableFeature "WAS-NetFxEnvironment" $PrereqID EnableFeature "WAS-ConfigurationAPI" $PrereqID EnableFeature "NetFx3" $PrereqID return EnableFeature "WCF-NonHTTP-Activation" $PrereqID } Function EnableREQ_TCP_Activation45 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_TCP_Activation45" $State = EnableFeature "WCF-TCP-Activation45" $PrereqID if (($State -eq "State : Enabled")) { $KeyPath = "HKCU:\Software\AspenTech\InstallPrereq" $KeyValue = (Get-ItemProperty -Path $KeyPath).State if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name WCF-TCP-Activation45 -Value 1 } } return $State } Function EnableREQ_HTTP_Activation45 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WCF45_win8" $State = EnableFeature "WCF-HTTP-Activation45" $PrereqID if (($State -eq "State : Enabled")) { $KeyPath = "HKCU:\Software\AspenTech\InstallPrereq" if (!(Test-Path $KeyPath) ) { New-Item $KeyPath } $KeyValue = (Get-ItemProperty -Path $KeyPath).State if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name WCF-HTTP-Activation45 -Value 1 } } return $State } Function EnableREQ_IIS { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS" return EnableFeature "IIS-WebServerRole" $PrereqID } Function EnableREQ_WEB_Sockets { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WEB_Sockets" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID return EnableFeature "IIS-WebSockets" $PrereqID } Function EnableREQ_IIS_ASP { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ASP" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID return EnableFeature "IIS-ASP" $PrereqID } Function EnableREQ_IIS_ASPNET { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ASPNET" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-ISAPIFilter" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID EnableFeature "IIS-DefaultDocument" $PrereqID EnableFeature "IIS-NetFxExtensibility" $PrereqID EnableFeature "IIS-ASPNET" $PrereqID #check only on windows 7 and windows 2008 r2 if([Environment]::OSVersion.Version.Major -eq "6" -and [Environment]::OSVersion.Version.Minor -eq "1") { #check registry if((Get-WmiObject Win32_OperatingSystem -computername .).OSArchitecture -eq "64-bit") { Try { $reg=Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\ASP.NET\4.0.30319.0\ if($reg.AssemblyVersion -eq "4.0.0.0") { $strcmd=$Env:Windir + "\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe /i" Write-Host "install and register ASP.NET 4 with the following command line:" -ForegroundColor BLACK Write-Host $strcmd -ForegroundColor BLACK cmd /c $strcmd } else { Write-Host "Cannot register ASP.NET 4. IIF feature IIS-NetFxExtensibility or IIS-ASPNET may not installed correctly." -ForegroundColor RED } } Catch { Write-Host "Cannot register ASP.NET 4. IIF feature IIS-NetFxExtensibility or IIS-ASPNET may not installed correctly." -ForegroundColor RED } } else { Try { $reg=Get-ItemProperty HKLM:\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0\ if($reg.AssemblyVersion -eq "4.0.0.0") { $strcmd=$Env:Windir + "\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe /i" Write-Host "install and register ASP.NET 4 with the following command line:" -ForegroundColor BLACK Write-Host $strcmd -ForegroundColor BLACK cmd /c $strcmd } else { Write-Host "Cannot register ASP.NET 4. IIF feature IIS-NetFxExtensibility or IIS-ASPNET may not installed correctly." -ForegroundColor RED } } Catch { Write-Host "Cannot register ASP.NET 4. IIF feature IIS-NetFxExtensibility or IIS-ASPNET may not installed correctly." -ForegroundColor RED } } } } Function EnableREQ_IIS_NetExtensibility { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_NetExtensibility" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID return EnableFeature "IIS-NetFxExtensibility" $PrereqID } Function EnableREQ_IIS_CGI { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_CGI" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID return EnableFeature "IIS-CGI" $PrereqID } Function EnableREQ_IIS_SvrsideInclude { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_SvrsideInclude" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID return EnableFeature "IIS-ServerSideIncludes" $PrereqID } Function EnableREQ_IIS_DigestAuth { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_DigestAuth" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-Security" $PrereqID return EnableFeature "IIS-DigestAuthentication" $PrereqID } Function EnableREQ_IIS_StaticContent { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_StaticContent" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-StaticContent" $PrereqID } Function EnableREQ_IIS_RequestFilt { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_RequestFilt" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID } Function EnableREQ_IIS_ISAPI { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ISAPI" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-ISAPIFilter" $PrereqID } Function EnableREQ_IIS_ManagementConsole { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ManagementConsole" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServerManagementTools" $PrereqID EnableFeature "IIS-ManagementConsole" $PrereqID } Function EnableREQ_IIS_WinAuth { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_WinAuth" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-WindowsAuthentication" $PrereqID } Function EnableREQ_IIS_BasicAuth { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_BasicAuth" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-BasicAuthentication" $PrereqID } Function EnableREQ_IIS_Tracing { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_Tracing" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-HealthAndDiagnostics" $PrereqID EnableFeature "IIS-HttpTracing" $PrereqID } Function EnableREQ_IIS_ASPNET45 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ASPNET45" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-ISAPIFilter" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID EnableFeature "IIS-DefaultDocument" $PrereqID EnableFeature "NetFx4Extended-ASPNET45" $PrereqID EnableFeature "IIS-NetFxExtensibility45" $PrereqID EnableFeature "IIS-ASPNET45" $PrereqID } Function EnableREQ_IIS_NetFxExtensibility45 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_NetFxExtensibility45" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-ISAPIFilter" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID EnableFeature "IIS-DefaultDocument" $PrereqID EnableFeature "NetFx4Extended-ASPNET45" $PrereqID EnableFeature "IIS-NetFxExtensibility45" $PrereqID } Function EnableREQ_IIS_HttpErrors { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_HttpErrors" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID return EnableFeature "IIS-HttpErrors" $PrereqID } Function EnableREQ_IIS_DefalutDoc { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_DefalutDoc" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID return EnableFeature "IIS-DefaultDocument" $PrereqID } Function EnableREQ_IIS_HttpRedirect { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_HttpRedirect" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID return EnableFeature "IIS-HttpRedirect" $PrereqID } Function EnableREQ_IIS6_Compatibility { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS6_Compatibility" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServerManagementTools" $PrereqID EnableFeature "IIS-IIS6ManagementCompatibility" $PrereqID EnableFeature "IIS-Metabase" $PrereqID EnableFeature "IIS-WMICompatibility" $PrereqID EnableFeature "IIS-LegacyScripts" $PrereqID EnableFeature "IIS-LegacySnapIn" $PrereqID } Function EnableREQ_WCF { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WCF" } Function EnableREQ_WCF35 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WCF35" } Function EnableREQ_WCF35_Win8 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WCF35_Win8" } Function EnableREQ_WCF45_win8 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_WCF45_win8" } Function EnableREQ_MSDTC { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_MSDTC" } Function EnableREQ_IIS_AUP_ALLOS { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_AUP_ALLOS" EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-CommonHttpFeatures" $PrereqID EnableFeature "IIS-DefaultDocument" $PrereqID EnableFeature "IIS-Security" $PrereqID EnableFeature "IIS-WindowsAuthentication" $PrereqID EnableFeature "IIS-WebServerManagementTools" $PrereqID EnableFeature "IIS-ManagementConsole" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-ISAPIExtensions" $PrereqID EnableFeature "IIS-ISAPIFilter" $PrereqID EnableFeature "IIS-RequestFiltering" $PrereqID EnableFeature "IIS-StaticContent" $PrereqID EnableFeature "IIS-HttpErrors" $PrereqID } Function EnableREQ_IIS_AUP_GT601 { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_AUP_GT601" if([Environment]::OSVersion.Version.Major -eq "10" -and [Environment]::OSVersion.Version.Minor -eq "0") { EnableFeature "IIS-WebServerRole" $PrereqID EnableFeature "IIS-WebServer" $PrereqID EnableFeature "IIS-ApplicationDevelopment" $PrereqID EnableFeature "IIS-WebSockets" $PrereqID EnableFeature "IIS-ASPNET45" $PrereqID EnableFeature "IIS-NetFxExtensibility45" $PrereqID } else { Write-Host "The features are only applicable on Windows 10 or Windows 2016." -ForegroundColor BLACK return "Error" } } Function DisableREQ_IIS_WebDAV { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_WebDAV" $State = DisableFeature "IIS-WebDAV" $PrereqID if (($State -eq "State : Disabled") -or ($State -eq "State : Disable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-WebDAV' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-WebDAV' -Value 1 } } return $State } Function EnableREQ_IIS_ApplicationDevelopment { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ApplicationDevelopment" $State = EnableFeature "IIS-ApplicationDevelopment" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-ApplicationDevelopment' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-ApplicationDevelopment' -Value 1 } } return $State } Function EnableREQ_IIS_ClientCertificateMappingAuthentication { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ClientCertificateMappingAuthentication" $State = EnableFeature "IIS-ClientCertificateMappingAuthentication" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-ClientCertificateMappingAuthentication' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-ClientCertificateMappingAuthentication' -Value 1 } } return $State } Function EnableREQ_IIS_HttpCompressionDynamic { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_HttpCompressionDynamic" $State = EnableFeature "IIS-HttpCompressionDynamic" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-HttpCompressionDynamic' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-HttpCompressionDynamic' -Value 1 } } return $State } Function EnableREQ_IIS_IIS6ManagementCompatibility { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_IIS6ManagementCompatibility" $State = EnableFeature "IIS-IIS6ManagementCompatibility" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-IIS6ManagementCompatibility' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-IIS6ManagementCompatibility' -Value 1 } } return $State } Function EnableREQ_IIS_IISCertificateMappingAuthentication { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_IISCertificateMappingAuthentication" $State = EnableFeature "IIS-IISCertificateMappingAuthentication" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-IISCertificateMappingAuthentication' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-IISCertificateMappingAuthentication' -Value 1 } } return $State } Function EnableREQ_IIS_IPSecurity { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_IPSecurity" $State = EnableFeature "IIS-IPSecurity" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-IPSecurity' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-IPSecurity' -Value 1 } } return $State } Function EnableREQ_IIS_LegacySnapIn { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_LegacySnapIn" $State = EnableFeature "IIS-LegacySnapIn" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-LegacySnapIn' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-LegacySnapIn' -Value 1 } } return $State } Function EnableREQ_IIS_LoggingLibraries { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_LoggingLibraries" $State = EnableFeature "IIS-LoggingLibraries" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-LoggingLibraries' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-LoggingLibraries' -Value 1 } } return $State } Function EnableREQ_IIS_ManagementScriptingTools { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ManagementScriptingTools" $State = EnableFeature "IIS-ManagementScriptingTools" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-ManagementScriptingTools' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-ManagementScriptingTools' -Value 1 } } return $State } Function EnableREQ_IIS_ManagementService { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ManagementService" $State = EnableFeature "IIS-ManagementService" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-ManagementService' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-ManagementService' -Value 1 } } return $State } Function EnableREQ_IIS_Metabase { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_Metabase" $State = EnableFeature "IIS-Metabase" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-Metabase' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-Metabase' -Value 1 } } return $State } Function EnableREQ_IIS_ODBCLogging { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ODBCLogging" $State = EnableFeature "IIS-ODBCLogging" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-ODBCLogging' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-ODBCLogging' -Value 1 } } return $State } Function EnableREQ_IIS_RequestMonitor { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_RequestMonitor" $State = EnableFeature "IIS-RequestMonitor" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-RequestMonitor' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-RequestMonitor' -Value 1 } } return $State } Function EnableREQ_IIS_URLAuthorization { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_URLAuthorization" $State = EnableFeature "IIS-URLAuthorization" $PrereqID if (($State -eq "State : Enabled") -or ($State -eq "State : Enable Pending")) { $KeyPath = "HKCU:\Software\AspenTech\MtellPrerequisite" $KeyValue = (Get-ItemProperty -Path $KeyPath).'IIS-URLAuthorization' if ($KeyValue -ne 1) { Set-ItemProperty -Path $KeyPath -Name 'IIS-URLAuthorization' -Value 1 } } return $State } Function EnableREQ_IIS_ApplicationInitialization { InitializeHostStyle if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } $PrereqID = "REQ_IIS_ApplicationInitialization" return EnableFeature "IIS-ApplicationInit" $PrereqID }