PowerTip: Find if Computer has .NET Framework 4.5

Summary: Use Windows PowerShell to find if a computer has .NET Framework 4.5.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find if my machine has .NET Framework 4.5 (required for Windows PowerShell 4.0)?

Hey, Scripting Guy! Answer Here’s a little function that finds this information for you:

function Test-Net45

{

    if (Test-Path ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’)

    {

if (Get-ItemProperty ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’ -Name Release -ErrorAction SilentlyContinue)

{

    return $True

}

return $False

    }

}

You can run it remotely, too:

PS C:ps-test> Invoke-Command -ComputerName Server01 -ScriptBlock {

function Test-Net45

{

>> if (Test-Path ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’)

>> {

>> if (Get-ItemProperty ‘HKLM:SOFTWAREMicrosoftNET Framework SetupNDPv4Full’ -Name Release -ErrorAction SilentlyContinue)

>> {

>>     return $True

>> }

>> return $False

>> }

>> }
>> #Run it now

>> Test-Net45}

True