Table of Contents |
---|
Introduction
Note |
---|
Please Install the .NET 3.5 Features AFTER you have installed all other necessary Windows Roles & Features |
For the installations of the CoreOne Suite, the .NET 3.5 and .NET 4.8 Framework on the Windows Server 2016 and newer versions is absolutely necessary, otherwise the WCF Service cannot be started. To install the .NET 3.5 and .NET 4.8 Framework on Windows Server, the installation ISO for the installed server OS must be mounted on the server
...
Code Block | ||
---|---|---|
| ||
.{ # Check if running as Administrator if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Host "Restarting script with Administrator privileges..." Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -Command `"& { $([System.Management.Automation.ScriptBlock]::Create($input)) } `" " -Verb RunAs -Wait -PassThru exit } # Set Execution Policy (temporary) try { Set-ExecutionPolicy Bypass -Scope Process -Force } catch { Write-Warning "Failed to set execution policy. Ensure you are running as an administrator." exit 1 } # Define Source Folder for .NET Installation $InstallationSourcesFolderDotNet = 'D:\sources\sxs' Write-Host "Checking if ISO is mapped..." if (Test-Path -Path $InstallationSourcesFolderDotNet) { Write-Host "ISO is mounted and path is accessible: $InstallationSourcesFolderDotNet" Write-Host "Starting installation of .NET Framework Features..." # Define Features to Install $features = @( "Net-Framework-Core", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", "NET-Framework-45-Features", "NET-Framework-45-Core", "NET-Framework-45-ASPNET", "NET-WCF-Services45", "NET-WCF-HTTP-Activation45", "NET-WCF-MSMQ-Activation45", "NET-WCF-Pipe-Activation45", "NET-WCF-TCP-Activation45", "NET-WCF-TCP-PortSharing45", "WAS", "WAS-Process-Model", "Web-WebSockets" ) $restartNeeded = $false # Install Features foreach ($feature in $features) { try { $result = Install-WindowsFeature -Name $feature -Source $InstallationSourcesFolderDotNet -ErrorAction Continue Stop if ($result.RestartNeeded -eq "Yes") { $restartNeeded = $true } } catch { if ($_ -match "requires a restart") { Write-Warning "Installation of $feature failed because a restart is required." $restartNeeded = $true break # Stop further installations until reboot } else { Write-Error "Failed to install $feature. Error: $_" } } } # Restart Confirmation if required if ($restartNeeded) { $restartServer = Read-Host "Finished installing .NET Features. A server restart is required before proceedingto complete the installation. Restart now? (y/n)" switch ($restartServer.ToLower()) { "y" { Restart-Computer -Force } "n" { Write-Warning "Please restart the server manually before proceeding." } default { Write-Warning "Invalid input. Please restart manually." } } } else { Write-Host "Installation completed successfully. No restart is required." } } else { Write-Error "The ISO for installing .NET features is not mounted, or the provided path is invalid. Please mount the correct ISO and rerun the script. Configured Path: $InstallationSourcesFolderDotNet" } } |
...