Powershell makes it easy to get information from remote servers.
Below is the query to find OS Version of all the remote servers you are connected with-
Step1- Create the list of all the servers in a notepad with name "serverlist.txt". I have saved this file on location "D:\Powershell" you can change it with your own location.
Step2- Execute below script-
PS C:\Windows\system32>$serverlist = Get-Content "D:\Powershell\serverlist.txt"
PS C:\Windows\system32>foreach($server in $serverlist)
{
$serverversion = Get-WmiObject -computer $server -cl Win32_OperatingSystem
write-output $server, $serverversion.version | out-file "D:\Powershell\OSVersion.txt" -append
}
You can also save the script in a notepad and save it with extension ".ps1". When you will execute the file OS Version for all the servers in the server list will store in the OSVersion file.