Category: PowerShell

PowerShell Windows Scripts

PowerShell and .Net version report on remote computers

PowerShell and .Net version report on remote computers

Hi Friends,

Here is powershell script to pull out report of PowerShell and .Net version on remote computer.

$computers = Get-Content -Path “C:\serverlist.txt”

ForEach($computer in $computers){
If(!(Test-Connection -ComputerName $computer -Count 1 -Quiet)) {
Write-Host -ForegroundColor Red “$computer is offline. Proceeding with next computer”
continue
} else {
Invoke-Command -ComputerName $computer -ScriptBlock {
$Lookup = @{
378389 = [version]’4.5′
378675 = [version]’4.5.1′
378758 = [version]’4.5.1′
379893 = [version]’4.5.2′
393295 = [version]’4.6′
393297 = [version]’4.6′
394254 = [version]’4.6.1′
394271 = [version]’4.6.1′
394802 = [version]’4.6.2′
394806 = [version]’4.6.2′
460798 = [version]’4.7′
460805 = [version]’4.7′
461308 = [version]’4.7.1′
461310 = [version]’4.7.1′
461808 = [version]’4.7.2′
461814 = [version]’4.7.2′
528040 = [version]’4.8′
528049 = [version]’4.8′
}

$computerOS = Get-WmiObject -Class Win32_OperatingSystem | Select-Object CSName,Caption
$OS = $computerOS.Caption
$ComputerN = $computerOS.CSName
$info = Get-ChildItem ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP’ -Recurse -ErrorAction SilentlyContinue |
Get-ItemProperty -name Version, Release -EA 0 |
Where-Object { $_.PSChildName -eq “Full”} | Select-Object PSComputerName, Version, Release
$netversion = $info.Version
$netrelease = $info.Release
$com = $info.PSComputerName
$PSver = $PSVersionTable.PSVersion.ToString()

New-Object -TypeName PSObject -Property @{
“ComputerName” = $ComputerN
“OperatingSystem” = $OS
“DotNetFramework” = $netversion
“DotNetRelease” = $netrelease
“PowerShellVersion” = $PSver
} | Select-Object ComputerName, OperatingSystem, DotNetFramework, DotNetRelease, PowerShellVersion | FT
}
}
}