Posted On February 7, 2020

PowerShell: Check DotNet Framework on Windows

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Check DotNet Framework on Windows
function checkDotNetVersions{
# General info:
# - Powershell 2.0 latest SSL version support is TLS 1.2
# - Powershell always uses DotNet framework to make HTTPS calls
# - DotNet 4.5 is required for TLS1.2
# Get .NET Versions
$translation = @{
378389 = [version]'4.5'
378675 = [version]'4.5.1'
378758 = [version]'4.5.1'
379893 = [version]'4.5.2'
393295 = [version]'4.6'
393297 = [version]'4.6'
394254 = [version]'4.6.1'
394271 = [version]'4.6.1'
394802 = [version]'4.6.2'
394806 = [version]'4.6.2'
460798 = [version]'4.7'
460805 = [version]'4.7'
461308 = [version]'4.7.1'
461310 = [version]'4.7.1'
461808 = [version]'4.7.2'
461814 = [version]'4.7.2'
528040 = [version]'4.8'
528049 = [version]'4.8'
}

$hive=Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse
$hiveObjects=$hive|Get-ItemProperty -name Version, Release -EA 0 |Where-Object { $_.PSChildName -match '^(?!S)\p{L}'}
$dotNetObjects=$hiveObjects |Select-Object @{name = ".NET Framework"; expression = {$_.PSChildName}},
@{name = "Product"; expression = {$translation[$_.Release]}},
Version, Release
return $dotNetObjects;
}
checkDotNetVersions

Sample Output:

PS C:\Windows\system32> checkDotNetVersions

.NET Framework Product Version Release
-------------- ------- ------- -------
v2.0.50727 2.0.50727.4927
v3.0 3.0.30729.4926
Windows Communication Foundation 3.0.4506.4926
Windows Presentation Foundation 3.0.6920.4902
v3.5 3.5.30729.4926
Client 4.8 4.8.03761 528049
Full 4.8 4.8.03761 528049
Client 4.0.0.0

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Split Array into Multiple Sub-Arrays and Inflate Strings to Certain Lengths to Create Visual Columns

What does a nerd do on his free time? Give himself little puzzles to solve.…

PowerShell: Gather All Guess VM of All Hyper-V Clusters in the Domain

# getAllVms.ps1 $clusterName='*' function includeRSAT{ $ErrorActionPreference='stop' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 #$rsatWindows7x32='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x86-RefreshPkg.msu' $rsatWindows7x64='https://download.microsoft.com/download/4/F/7/4F71806A-1C56-4EF2-9B4F-9870C4CFD2EE/Windows6.1-KB958830-x64-RefreshPkg.msu' $rsatWindows81='https://download.microsoft.com/download/1/8/E/18EA4843-C596-4542-9236-DE46F780806E/Windows8.1-KB2693643-x64.msu' $rsat1709 = "https://download.microsoft.com/download/1/D/8/1D8B5022-5477-4B9A-8104-6A71FF9D98AB/WindowsTH-RSAT_WS_1709-x64.msu"…

Install AWS Command Line Interface on Windoze

Obtain AWS Access Key: Log into AWS > click on your User Name > My…