Last active
August 1, 2020 16:28
-
-
Save Admin0fThings/40dd710435020d25e4edf7bb393cec63 to your computer and use it in GitHub Desktop.
Get VMs and Clusters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all clusters | |
$clusters = Get-Cluster | |
# Loop through each cluster | |
$result = foreach ($cluster in $clusters) { | |
# Use calculated properties to create custom object | |
Get-VM -Location $cluster | Select @{n='Cluster';e={$cluster}},@{n='VM Name';e={$_.Name}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment