Skip to content

Commit

Permalink
FInd what's the current Net Framework installed
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Jul 31, 2024
1 parent a88884c commit 2b151f2
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Public/Computers/Get-ComputerNetFramework.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function Get-ComputerNetFramework {
<#
.SYNOPSIS
Get the installed .NET Framework version on a computer
.DESCRIPTION
Get the installed .NET Framework version on a computer
.PARAMETER ComputerName
The name of the computer to check the .NET Framework version on
.EXAMPLE
$DCs = Get-ADDomainController -Filter * -Server 'ad.evotec.xyz'
Get-ComputerNetFramework -ComputerName $Dcs.HostName | Format-Table *
.NOTES
General notes
#>
[CmdletBinding()]
param(
[string[]] $ComputerName = $env:COMPUTERNAME
)
foreach ($Computer in $ComputerName) {
$Output1 = Get-PSRegistry -ComputerName $Computer -RegistryPath 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client'
#$Output2 = Get-PSRegistry -ComputerName $Computer -RegistryPath 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full'
if ($Output1.PSError -eq $false) {
[PSCustomObject] @{
ComputerName = $Computer
NetFrameworkVersion = $Output1.Version
NetFrameworkRelease = $Output1.Release
Message = ""
}
} else {
[PSCustomObject] @{
ComputerName = $Computer
NetFrameworkVersion = 'Not Installed'
NetFrameworkRelease = 'Not Installed'
Message = $Output1.PSErrorMessage
}
}
}
}

0 comments on commit 2b151f2

Please sign in to comment.