PowerTip: Find if Computer has .NET Framework 4.5

PowerTip: Find if Computer has .NET Framework 4.5

  • Comments 1
  • Likes

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:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full')

    {

if (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -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:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full')

>> {

>> if (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release -ErrorAction SilentlyContinue)

>> {

>>     return $True

>> }

>> return $False

>> }

>> }
>> #Run it now

>> Test-Net45}

True

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Acceleration is a fast growing start-up which is having their ERP Web solutions for Education, Finance & Hospitality domain.