MyITGuy
8/12/2015 - 2:52 PM

PowerShell: List installed .NET versions

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