How to find .NET Framework version using PowerShell

Posted by in PowerShell

Often times when I am getting ready to install Exchange 2016 or Exchange 2013, I look at pre-requisites and wonder if correct version of .NET Framework is already installed on the server or not. It certainly saves me time if it is already installed and depending on status of latest OS patch installation, it is highly likely that the required framework is already installed.

I think I have written a script in past but never published it. And can’t find anymore. So I just searched and found a script from Joel Bennett (@jaykul) which I think is simple and gets me the information I need. I also added reference of .Net Framework version numbers listed on this MSDN article: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx.

And for benefit of those who end up on this page, I am posting the lightly modified script here:

#All Credits to @JayKul for script posted on http://stackoverflow.com/questions/3487265/powershell-script-to-return-versions-of-net-framework-on-a-machine/3495491#3495491
function Get-FrameworkVersions()
{
Write-Host ""
Write-Host "Version Table on MSDN: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx"
Write-Host "Release 379893 is .NET Framework 4.5.2" -ForegroundColor "Yellow"
Write-Host ""
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release
}

Enjoy!

Print Friendly