Posted in
Windows Powershell,
Windows Server |
No Comment | 6,711 views | 05/08/2014 14:28
You can get operating system report of your remote servers via PowerShell:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
try
{
$OS = Get-WmiObject -ComputerName $Server -Class Win32_OperatingSystem -EA Stop
$OSName = $OS.Caption
$SPV = $OS.CSDVersion
$Value = $Server + ";" + $OSName + ";" + $SPV
Write-Host $Value
}
catch
{
Write-Host $_
}
} |
Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
try
{
$OS = Get-WmiObject -ComputerName $Server -Class Win32_OperatingSystem -EA Stop
$OSName = $OS.Caption
$SPV = $OS.CSDVersion
$Value = $Server + ";" + $OSName + ";" + $SPV
Write-Host $Value
}
catch
{
Write-Host $_
}
}
That will give you OS Name and Service Pack version.