checking a cluster to see about MM (scsi bus sharing)

$clname = “HOSA-P-FARM06-ProSuites”
$clustertocheck = Get-Cluster $clname
Write-Host “Checking $clname” -ForegroundColor cyan
$vmhs = $clustertocheck | Get-VMHost | sort name
foreach ($vmh in $vmhs){
$scsishared = $null
$vms = $vmh | Get-VM | sort name
#$hostver = $vmh | get-View -Property Name,Config.Product | Format-Table Name, @{L=’Version’;E={$_.Config.Product.FullName}}
$scsishared = $vms |Get-ScsiController | Where-Object {$_.BusSharingMode -eq ‘Physical’ -or $_.BusSharingMode -eq ‘Virtual’}
if (!$scsishared){
if ($vmh.ConnectionState -eq “Maintenance”){write-host “$vmh is in MM already, host is $vmh.Version”}
if ($vmh.ConnectionState -ne “Maintenance”){Write-host “$vmh is okay, no shared SCSIBUS vms” -foregroundcolor yellow}
if ($scsishared) { Write-Host “$vmh is NOT okay, SCSIBUS SHARED vms” -foregroundcolor red }

Leave a Reply

Your email address will not be published. Required fields are marked *