Skip to content

Instantly share code, notes, and snippets.

@tonysangha
Created March 6, 2017 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonysangha/3818bdfd2dc1c22117bbd819c56264da to your computer and use it in GitHub Desktop.
Save tonysangha/3818bdfd2dc1c22117bbd819c56264da to your computer and use it in GitHub Desktop.
Get Hosts and VMs that belong to certain vSphere clusters using PowerCLI - (OR) Statement
$clusters = get-cluster
$clusters | Where-Object {$_.name -like "XXXXX" -OR $_.name -like "XXXXX"} | get-vmhost | select name, Manufacturer, Model, ProcessorType, NumCpu, Version, Build, Parent
$clusters | Where-Object {$_.name -like "XXXXX" -OR $_.name -like "XXXXX"} | get-vm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment