Skip to content

Instantly share code, notes, and snippets.

@MyITGuy
Last active June 9, 2021 04:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MyITGuy/b4497f042d59f1c7b91d to your computer and use it in GitHub Desktop.
Save MyITGuy/b4497f042d59f1c7b91d to your computer and use it in GitHub Desktop.
PowerShell: List installed .NET versions
Get-ChildItem -Path "$($env:WINDIR)\Microsoft.NET\Framework*" | % {Get-ChildItem -Path "$($_.PSPath)" | ? {$_.Name.StartsWith('v') -and $_.PSIsContainer -eq $true -and ((Test-Path -Path "$($_.FullName)\mscorlib.dll" -PathType Leaf) -eq $true)}} | Select @{Name="Version";Expression={$_.Name.TrimStart('v')}},@{Name="Bitness";Expression={if (!$_.Parent.ToString().TrimStart('Framework')) {[int]32} else {[int]$_.Parent.ToString().TrimStart('Framework')}}}
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version, Release -ErrorAction SilentlyContinue | Where-Object { $_.PSChildName -match '^(?!S)\p{L}' } | Select-Object -Property Version, Release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment