Created
January 12, 2018 15:57
-
-
Save VimalShekar/8cfabf6361c6e313c5c829eb36c32035 to your computer and use it in GitHub Desktop.
Checks if .NET framework v2.0 or newer is available on the machine using PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Get the full script here:https://github.com/VimalShekar/PowerShell/blob/master/CheckDotNet.ps1 | |
Function IsDotNet2orGreater { | |
# Check if .NET version 2.0 or greater is present | |
[bool] $bVersionPresent = $false | |
$Frameworks = Get-ChildItem "HKLM:\Software\Microsoft\NET Framework Setup\NDP" | |
foreach($FWver in $Frameworks) { | |
# if it matches v[0-9].+ and is >= v2.0 then requisite is met | |
if(($FWver.PSChildName -match "v[0-9].+") -and ($FWver.PSChildName -ge "v2.0")) | |
{ | |
$bVersionPresent = $true | |
break | |
} | |
} | |
return $bVersionPresent | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment