Tuesday, February 13, 2024

#108: How to find the version of .NET installed using Powershell

Below is small snippet that might help you in this case. 

# Get installed versions of .NET Framework
$dotNetVersions = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse | Get-ItemProperty -Name Version -ErrorAction SilentlyContinue | Where-Object { $_.Version -match '^4.' -or $_.Version -eq 'v2.0.50727' }

# Output information about each installed .NET Framework version
foreach ($version in $dotNetVersions) {
    Write-Output ".NET Framework Version: $($version.Version)"
    Write-Output "-----------------------------"
}


No comments:

Post a Comment

#112: How to handle xml document in Powershell?

 In PowerShell, you can handle XML data using various cmdlets and methods provided by the .NET Framework. Here's a basic guide on how to...