Param($LogFile) if ((Get-Service -Name ClusSvc -ErrorAction SilentlyContinue).Status -ne "Running") { return 0 exit } $ret = (Get-StorageSubsystem -FriendlyName "Cluster*"| Get-PhysicalDisk | ? {$_.HealthStatus -ne "Healthy"} | Select DeviceId, HealthStatus, Size, AllocatedSize, PhysicalLocation) if ($ret -eq $null) { #Healthy return 0 } else { if($LogFile -ne $null) { if (Test-Path "$LogFile.old") { Remove-Item "$LogFile.old" } if (Test-Path "$LogFile") { Copy-Item $LogFile "$LogFile.old" } $ret 2>&1 | Out-File -Encoding default $LogFile } if ($ret.Count -eq $null) { return 1 } else { return $ret.Count } }