PowerShell: Set Hyper-V Cluster Quorum

# setClusterQuorum.ps1

$clusterQuorum="\\FILESHERVER007\CLUSTER007"

function setClusterQuorum($clusterQuorum){
    $quorumType=if($clusterQuorum -match '^\\\\'){'NodeAndFileShareMajority'}else{'NodeAndDiskMajority'}
    if(test-path $clusterQuorum){
        if($quorumType -eq 'NodeAndFileShareMajority'){
            Set-ClusterQuorum -NodeAndFileShareMajority $clusterQuorum
        }elseif($quorumType -eq 'NodeAndDiskMajority'){
            Set-ClusterQuorum -NodeAndDiskMajority $clusterQuorum
        }else{
            write-warning 'Path is invalid.'
            }
    }else{
        write-warning "$clusterQuorum is unreachable from $env:computername using account $env:username"
        }
    }
setClusterQuorum $clusterQuorum

Leave a Reply

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