Microsoft .NET Framework Detection Scripts (PowerShell)

Microsoft Endpoint Manager Configuration Manager (MEMCM / SCCM) and Microsoft Intune use Detection Rules to determine the presence of Applications & Win32 Apps. The detection rules ensure that application installations only begin to run if the application is not already installed on the device. This article will serve as an informative guide and give you a clear understanding of how to confirm if a specific version of Microsoft .NET Framework is installed on a system using PowerShell detection scripts.

Check for Microsoft .NET Framework (Registry Detection Method)

Microsoft .NET Framework 4.8.1 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.8.1 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 533320) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.8 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.8 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 528040) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.7.2 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.7.2 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 461808) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.7.1 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.7.1 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 461308) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.7 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.7 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 460798) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.6.2 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.6.2 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 394802) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.6.1 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.6.1 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 394254) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.6 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.6 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 393295) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.5.2 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.5.2 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 379893) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.5.1 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.5.1 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 378675) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.5 (Registry Detection Method)

## Check for Microsoft .NET Framework 4.5 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Release -ge 378389) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.0 Full Profile (Registry Detection Method)

## Check for Microsoft .NET Framework 4.0 Full Profile (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 4.0 Client Profile (Registry Detection Method)

## Check for Microsoft .NET Framework 4.0 Client Profile (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 3.5 (Registry Detection Method)

## Check for Microsoft .NET Framework 3.5 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 3.0 (Registry Detection Method)

## Check for Microsoft .NET Framework 3.0 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.0\Setup" -ErrorAction SilentlyContinue
If ($Version.InstallSuccess -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 2.0 (Registry Detection Method)

## Check for Microsoft .NET Framework 2.0 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 1.1 (Registry Detection Method)

## Check for Microsoft .NET Framework 1.1 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v1.1.4322" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Microsoft .NET Framework 1.0 (Registry Detection Method)

## Check for Microsoft .NET Framework 1.0 (Registry Detection Method)
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\.NETFramework\Policy\v1.0\3705" -ErrorAction SilentlyContinue
If ($Version.Install -eq 1) {
Write-Host "Installed"
}

Always make sure to test everything in a development environment prior to implementing anything into production. The information in this article is provided “As Is” without warranty of any kind.

Jason Bergner

I am an accomplished Software Engineer at Patch My PC, leveraging more than 18 years of hands-on experience in Configuration Manager administration and application packaging. I am driven by a genuine passion for solving complex problems and consistently strive to discover innovative and effective solutions. Sharing my extensive knowledge of application deployments is a true joy for me, and I am honored to contribute to the community here at Silent Install HQ.

Recent Posts