search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Virtual Machine Manager, Windows Powershell, Windows Server | No Comment | 1,154 views | 05/06/2014 15:55

If you need to get Windows OS and Version information of a list of servers, then you can use following script.

1
2
3
4
5
6
7
8
9
10
$Servers = Get-Content Servers.txt
foreach ($Server in $Servers)
{
	$OSInfo = $Null;
	$CompInfo = $Null;
	$OSInfo = Get-WmiObject -ComputerName $Server -Class "Win32_OperatingSystem"
	$CompInfo = Get-WmiObject -ComputerName $Server -Class "Win32_ComputerSystem"
	$Value = $Server + ";" + $OSInfo.Caption + ";" + $OSInfo.CSDVersion + ";" + $OSInfo.BuildNumber + ";" + $OSInfo.Version + ";" + $CompInfo.Manufacturer + ";" + $CompInfo.Model
	Add-Content -Value $Value -Path ServerOSInfo.txt
}

That will output all data into ServerOSInfo.txt file.