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 through Powershell.

Call the Powershell about Server Manager - Tools - Windows PowerShell ISE. Copy and paste the Script and execute it (Play-Button).

Code Block
languagepowershell
###.{
Please	# mountCheck theif correspondingrunning ISOas toAdministrator
your OS Version and define the Source-Folder below
$InstalllationSourcesFolderDotNet35 = 'D:\sources\sxs'

	if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
		Write-Host "Restarting    [i] Check if ISO is mapped."
if (Test-Path -Path $InstalllationSourcesFolderDotNet35) {
            Write-Host "    [i] ISO is mounted and Path is accessible:" $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

            $restartServer = Read-Host "    [?] FFinished installing .NET 3.5 Features. Please check the Output for any Errors. It is mandatory, to restart the Server before installing the CoreOne Suite or other dependencies. Restart Server now? [y/n]"
            switch($restartServer){
                    y{Restart-computer -Force -Confirm:$false}
                    n{Write-Host "    [w] Please make sure to start the Server manually before executing further installations steps."
                      pause}
                    default{Write-Warning "    [w] Invalid Input"}
                    }
            } else {
            Write-Host "    [e] Your 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 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 3.5features is not mappedmounted, or the givenprovided Pathpath is not valid. Installation will abortinvalid. Please mount the correspondingcorrect ISO to your OS Version and executererun the script again. Configured Path: $InstallationSourcesFolderDotNet"
$InstalllationSourcesFolderDotNet35
           	}
}