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?
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With