Get-FrameworkVersions

Read the registry to determine which .NET Framework version(s) is/are installed

Function Get-Framework-Versions()
{
    $installedFrameworks = @()
    $regkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $server)
    if($regKey.OpenSubKey("Software\Microsoft\.NETFramework\Policy\v1.0.3705")) { $installedFrameworks += "v.1.0" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v1.1.4322")) { $installedFrameworks += "v.1.1" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v2.0.50727")) { $installedFrameworks += "v.2.0" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v3.0\Setup")) { $installedFrameworks += "v.3.0" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v3.5")) { $installedFrameworks += "v.3.5" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v4\Client")) { $installedFrameworks += "v.4.0 (Client)" }
    if($regKey.OpenSubKey("Software\Microsoft\NET Framework Setup\NDP\v4\Full")) { $installedFrameworks += "v.4.0 (Full)" }
    
    return $installedFrameworks
}

Leave a Reply

Scroll to Top