Windows Cluster Information through powershell

 The below script extract information about Cluster resource status in  Windows Cluster

cls
#ClusterResource
$GetClusterInfo=Get-ClusterResource
$GetClusterInfo|
ForEach-Object{
$GetClustInfo=$_
if($GetClustInfo.State -ne 'Online')
{
  $GetClustInfo|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Red
}
else
{
 $GetClustInfo|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Green
}
};
#Cluster Netwok
$GetClusterNetwork=Get-ClusterNetwork
$GetClusterNetwork|
ForEach-Object{
$GetClustNet=$_
if($GetClustNet.State -ne 'UP')
{
  $GetClustNet|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Red
}
else
{
 $GetClustNet|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor DarkYellow
}
};

#Cluster NetworkInterface
$GetClustNetInterface=Get-ClusterNetworkInterface
$GetClustNetInterface|
ForEach-Object{
$GetClustNetINter=$_
if($GetClustNetINter.State -ne 'UP')
{
$GetClustNetINter|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Red
}
else
{
$GetClustNetINter|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor DarkMagenta
}
};
#Get ClusterNode
$GetClustNode=Get-ClusterNode
$GetClustNode|ForEach-Object{
$GetClusterNodes=$_
if($GetClusterNodes.State -ne 'UP')
{
 $GetClusterNodes|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Red
}
else
{
   $GetClusterNodes|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Cyan
}
};
#Virtual Disk info
$GetVirtualDisk=Get-VirtualDisk 
$GetVirtualDisk|ForEach-Object{
$GetVDisk=$_
if(($GetVDisk.OperationalStatus -ne 'OK')-OR($GetVDisk.HealthStatus -NE 'Healthy'))
{
  $GetVDisk|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor Red
}
else
{
 $GetVDisk|Format-Table -AutoSize|Out-String|Write-Host -ForegroundColor DarkYellow
}
}

Comments

Popular posts from this blog

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

Pre login Handshake or Connection Timeout Period

Transparent Data Encryption(TDE) with Master Key and Certificate in SQL Server