Check the .NET Version Installed

April 18th, 2018

Want to know which .NET version is installed on your computer or server?


Function Get-NetVersion{

    $net = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name "Release"

    $array = @(@("378389",".NET Framework 4.5"),
                @("378675",".NET Framework 4.5.1 installed with Windows 8.1 or Windows Server 2012 R2"),
                @("378758",".NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2"),
                @("379893",".NET Framework 4.5.2")
                @("393295",".NET Framework 4.6"),
                @("393297",".NET Framework 4.6"),
                @("394254",".NET Framework 4.6.1"),
                @("394271",".NET Framework 4.6.1"),
                @("394802",".NET Framework 4.6.2"),
                @("394806",".NET Framework 4.6.2"),
                @("460798",".NET Framework 4.7"),
                @("460805",".NET Framework 4.7"),
                @("461308",".NET Framework 4.7.1")
                @("461310",".NET Framework 4.7.1"))

    foreach ($item in $array){ 
        if ($item[0] -eq $net.Release) {
            Write-Host ".Net Version Installed is [" -NoNewline -ForegroundColor Cyan
            Write-Host "$($item[1])" -ForegroundColor Yellow -NoNewline
            Write-Host "]" -ForegroundColor Cyan
        }
    }    

}

Get-NetVersion

Leave a Reply

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