September 25, 2021

USEFUL-IT

A blog for USEFUL-IT information

POWERSHELL CHALLENGE 002 : ClusterReservestate

PS Challenge

Show the state of the ClusterReserveState on every Cluster in our Hyper-V environment

All Hosts in all Environments

I would like that the output looks like this.

Name ClusterReserveState
---- -------------------
Server001.usefullab.nl OK
Server002.usefullab.nl OK
…
…

Extra challenge : One-Liner (Import-module line exluded)


Solution :

Import-Module virtualmachinemanager

'VMMServer001','VMMServer002' | foreach {Get-SCVMHostCluster -vmmserver $_} | Sort-object Name | Select Name, ClusterReserveState, ClusterReserve, @{label="NodeCount";expression={$_.nodes.count}}