Powershell: Get-Framework-Versions.

Posted by marc dekeyser on Geeks with Blogs See other posts from Geeks with Blogs or by marc dekeyser
Published on Wed, 05 Dec 2012 08:17:55 GMT Indexed on 2012/12/05 11:07 UTC
Read the original article Hit count: 251

Filed under:
This function will use the test-key function posted earlier. It will check which .NET frameworks are installed (currently only checking for .NET 4.0) but can be easily adapted and/or expanded.

function Get-Framework-Versions()
{
    $installedFrameworks = @()

    if(Test-Key "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Client" "Install") { $installedFrameworks += "4.0c" }
    if(Test-Key "HKLM:\Software\Microsoft\NET Framework Setup\NDP\v4\Full" "Install") { $installedFrameworks += "4.0" }  
    
    return $installedFrameworks
}

© Geeks with Blogs or respective owner