I want to share simple PowerShell script to see the current state of HA Drives
This script based on StarWind example, but simplified.
Code: Select all
$server = New-SWServer -host ecvpsql1bshr -user root -password starwind -port 3261
$server.Connect()
if ( $server.Connected )
{
write-host "Devices:"
foreach($device in ($server.Devices | where {$_.deviceType -eq 'HA Image'}))
{
$syncState = $device.GetPropertyValue("ha_synch_status")
$syncPercent = $device.GetPropertyValue("ha_synch_percent")
switch($syncState)
{
1 {$deviceState = 'Synchronized'}
2 {$deviceState = 'Synchronizing'}
3 {$deviceState = 'Not synchronized'}
default {$deviceState = 'Unknown state'}
}
Write-Host $device.TargetName "$deviceState ($syncPercent%)" -ForegroundColor Yellow
}
$server.Disconnect()
}