Version .NET Framework

Inhaltsverzeichnis

Frage: Wie kann ich die .NET Framework Version der Geräte ermitteln?

Antwort:

Mit diesem Powershell-Skript kann die Version des .NET Framework aus der Registry des jeweiligen Gerätes ermittelt werden.

Hinweis: Bitte nur den Code zwischen den ‘<snip>’-Tags kopieren. Das Skript kann in der Skriptbibliothek der River als Job-Skript verwendet werden.

Skript-Code #

<snip>

# Path and Subkey in Registry
$DotNET_regPath = “HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full”
$DotNET_regKey= “Release”

# .NET Framework version from Registry
$DotNET_releaseKey = (Get-ItemProperty $DotNET_regPath -Name $DotNET_regKey).$DotNET_regKey

# Carriage Return
$Line_Break = “`r`n”

# Information:
# https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies#net-framework-471

# valid .NET Framework releases
$DotNET_Frameworks = @{

‘378389’ = ‘.NET Framework v4.5’ +$Line_Break+ ‘All Windows operating systems: 378389’
‘378675’ = ‘.NET Framework v4.5.1’ +$Line_Break+ ‘On Windows 8.1 and Windows Server 2012 R2: 378675’
‘378758’ = ‘.NET Framework v4.5.1’ +$Line_Break+ ‘On all other Windows operating systems: 378758’
‘379893’ = ‘.NET Framework v4.5.2’ +$Line_Break+ ‘All Windows operating systems: 379893’
‘393295’ = ‘.NET Framework v4.6’ +$Line_Break+ ‘On Windows 10: 393295’
‘393297’ = ‘.NET Framework v4.6’ +$Line_Break+ ‘On all other Windows operating systems: 393297’
‘394254’ = ‘.NET Framework v4.6.1’ +$Line_Break+ ‘On Windows 10 November Update systems: 394254’
‘394271’ = ‘.NET Framework v4.6.1’ +$Line_Break+ ‘On all other Windows operating systems’ +$Line_Break+ ‘(including Windows 10): 394271’
‘394802’ = ‘.NET Framework v4.6.2’ +$Line_Break+ ‘On Windows 10 Anniversary Update and Windows Server 2016: 394802’
‘394806’ = ‘.NET Framework v4.6.2’ +$Line_Break+ ‘On all other Windows operating systems’ +$Line_Break+ ‘(including other Windows 10 operating systems): 394806’
‘460798’ = ‘.NET Framework v4.7’ +$Line_Break+ ‘On Windows 10 Creators Update: 460798’
‘460805’ = ‘.NET Framework v4.7’ +$Line_Break+ ‘On all other Windows operating systems’ +$Line_Break+ ‘(including other Windows 10 operating systems): 460805’
‘461308’ = ‘.NET Framework v4.7.1’ +$Line_Break+ ‘On Windows 10 Fall Creators Update’ +$Line_Break+ ‘and Windows Server, version 1709: 461308’
‘461310’ = ‘.NET Framework v4.7.1′ +$Line_Break+’On all other Windows operating systems’ +$Line_Break+ ‘(including other Windows 10 operating systems): 461310’
‘461808’ = ‘.NET Framework v4.7.2′ +$Line_Break+’On Windows 10 April 2018 Update’ +$Line_Break+ ‘and Windows Server, version 1803: 461808’
‘461814’ = ‘.NET Framework v4.7.2’ +$Line_Break+ ‘On all Windows operating systems’ +$Line_Break+ ‘other than Windows 10 April 2018 Update’ +$Line_Break+ ‘and Windows Server, version 1803: 461814’
‘528040’ = ‘.NET Framework v4.8’ +$Line_Break+ ‘On Windows 10 May 2019 Update’ +$Line_Break+ ‘and Windows 10 November 2019 Update: 528040’
‘528372’ = ‘.NET Framework v4.8’ +$Line_Break+ ‘On Windows 10 May 2020 Update,’ +$Line_Break+ ‘October 2020 Update, May 2021 Update,’ +$Line_Break+ ‘November 2021 Update, and 2022 Update: 528372’
‘528449’ = ‘.NET Framework v4.8′ +$Line_Break+’On Windows 11 and Windows Server 2022: 528449’
‘528049’ = ‘.NET Framework v4.8’ +$Line_Break+ ‘On all other Windows operating systems’ +$Line_Break+ ‘(including other Windows 10 operating systems): 528049’
‘533320’ = ‘.NET Framework v4.8.1’ +$Line_Break+ ‘On Windows 11 2022 Update: 533320’
‘533325’ = ‘.NET Framework v4.8.1’ +$Line_Break+ ‘All other Windows operating systems: 533325’

}

# Only execute if Release is valid
if ($DotNET_releaseKey) {

# Iterate through list
foreach ($DotNET_key in $DotNET_Frameworks.Keys) {

# Compare key with list of releases
if ($DotNET_key -eq $DotNET_releaseKey) {

# Print message for the found key
$message = ‘{0}’ -f $DotNET_Frameworks[$DotNET_key]
Write-Output $message
exit 0

}

}

# Print message, if any valid .NET Framework release was found
$message = ‘Unable to detect a valid .NET Framework Version.’
Write-Output $message

}

exit 0

<snip>

Skript-Ausgabe #

Abb. 1

High Quality Theme

There is a fine line between creating greatness and accomplishing awesomeness. This time, we worked to prove that sky is not the limit.

Fill out the form to subscribe to our newsletter.

[contact-form-7 404 "Nicht gefunden"]

High Quality Theme

There is a fine line between creating greatness and accomplishing awesomeness. This time, we worked to prove that sky is not the limit.

Fill out the form to subscribe to our newsletter.

[contact-form-7 404 "Nicht gefunden"]