Using Compare-Object to audit group memberships for differences
As mentioned in the Listing the members of a DRS group recipe, you can easily compare a rule to the existing configuration as an auditing procedure. In this recipe, you will retrieve the list of existing VMs in the group, and then compare that with a list of the VMs from the desired group. You will use the group created in the Creating a DRS group for virtual machines recipe named TTYLinux VMs
.
To make the results interesting, compare against the virtual machines WinVM1
and TTYLinux1
. Only one of these should be a match, while the others should fall out as differences. Then, you can compare the existing groups against a wildcard pattern match of TTYLinux*
.
Getting ready
To begin this ...
Get PowerCLI Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.