Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remotely find the .NET version on a server list with PowerShell?

Tags:

powershell

I am trying to find version of .NET installed on a list of servers. What would be a PowerShell script to do the same where servers are provided as a .txt file and they are enumerated to find the .NET version on the servers?

like image 657
nipiv Avatar asked Jul 12 '11 21:07

nipiv


1 Answers

Refer to Stack Overflow question PowerShell script to return versions of .NET Framework on a machine? on how to find the framework.

For doing it on many servers, the list being from a .txt, you can use Get-Content to read the file, pipe it to Invoke-Command and pass the command that you select from the above linked answers to get the framework.

$script = {gci 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' | sort pschildname -des | select -fi 1 -exp pschildname}
gc list.txt | %{ Invoke-Command -comp $_ -ScriptBlock $script}
like image 88
manojlds Avatar answered Nov 15 '22 05:11

manojlds