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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell, Windows Server | No Comment | 998 views | 14/02/2014 18:37

You can use following script to see if remote host has cluster service:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$Servers = Get-Content C:\Servers.txt
foreach ($Server in $Servers)
{
	try
	{
		$State = (Get-WmiObject -ComputerName $Server -Class Win32_service | Where Name -like *clu*).State
	}
	catch
	{
	}
 
 
	if ($State)
	{
		Write-Warning $Server
		Add-Content -Value $Server -Path C:\ClusterResults.txt
	}
	else
	{
		Write-Host $Server
	}
}

Script will output all results into C:\ClusterResults.txt.