Posted in
Windows Powershell,
Windows Server |
No Comment | 1,208 views | 14/02/2014 10:10
You can type your servers into C:\Servers.txt and check WBEM status.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| $Servers = Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
try
{
$TestWBEM = (Get-Item "\\$Server\C$\Program Files\HPWBEM\Tools\HPWbemTestEvent.exe" -ErrorAction SilentlyContinue).Exists
}
catch
{
}
if ($TestWBEM -eq $True) { $TestWBEM = "True"; } else { $TestWBEM = "False"; }
$Value = $Server + ";" + $TestWBEM
Add-Content -Value $Value -Path C:\Results.txt
} |
$Servers = Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
try
{
$TestWBEM = (Get-Item "\\$Server\C$\Program Files\HPWBEM\Tools\HPWbemTestEvent.exe" -ErrorAction SilentlyContinue).Exists
}
catch
{
}
if ($TestWBEM -eq $True) { $TestWBEM = "True"; } else { $TestWBEM = "False"; }
$Value = $Server + ";" + $TestWBEM
Add-Content -Value $Value -Path C:\Results.txt
}
That will export all data into C:\Results.txt.