Get-drsrule enhancement

I was doing some drs rules today and noticed( after all those years 😉 ) that i get only id’s for vms in output. So i can not see directly which vms for example are set to be together etc…
In order to quickly have the output with the names instead of ids i wrote this tiny enhancement:

get-cluster XXX | Get-DrsRule | select Name, KeepTogether,Enabled, @{N="VMnames";E={ $_.Vmids|%{(get-view -id $_).name} } } 

If the output is not optimized you can always use |ft -autosize at the end of the line.
For each of the virtual machine id i get the vm view and take its name.
You can do get-vm -id or get-view -id. If there is small amount of vms in your rules, that would not affect any performance of this command.
Tiny enhancement but saves some time on checking those ids manually.

One thought on “Get-drsrule enhancement

Leave a Reply to LittleNickey Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s