Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
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

...

Navigate to “Add Roles and Features” in the Server Manager and select the .Net Framework 3.5 Features.

...

Navigate to “Add Roles and Features” in the Server Manager and select the .NET Framework 3.5 Features.

...

  1. Mount the Windows ISO as d: → D:\Sources\sxs

...

  1. is required

  2. Run the Powershell Script from Administrator Shell

Powershell Script for installing the required .NET 3.5 Features

The above listed required .NET 3.5 / .NET 4.8 Features can be installed thorugh through Powershell.

Call the Powershell about Server Manager - Tools - Windows PowerShell ISE. Copy and Paste the script and Execute it (Play-Button).

...

languagepowershell

...

Code Block
languagepowershell
.{
	# 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 "    [i] Check Checking if ISO is mapped..."
	if (Test-Path -Path $InstalllationSourcesFolderDotNet35$InstallationSourcesFolderDotNet) {
            		Write-Host "    [i] ISO is mounted and Pathpath is accessible: $InstallationSourcesFolderDotNet"
		Write-Host " $InstalllationSourcesFolderDotNet35
            Write-Host "    [i] Start Installation of .NET 3.5 Feature"
            Install-WindowsFeature Net-Framework-Core -source $InstalllationSourcesFolderDotNet35
            Add-WindowsFeature NET-HTTP-Activation,NET-Non-HTTP-Activ -source $InstalllationSourcesFolderDotNet35
            } else {
            Write-Host "    [e] Your ISO for installing .NET 3.5 is not mapped or the given Path is not valid. Installation will abort. Please mount the corresponding ISO to your OS Version and execute the script again. Configured Path: " $InstalllationSourcesFolderDotNet35
           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 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 "A restart is required to 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"
	}
}