0

How can I get list of all the virtual machines in my vSphere cloud from inside a jenkins pipeline? I couldn't find such an option in the vSphere Plugin for Jenkins. Thanks

Mor Vino
  • 85
  • 7
  • Is there a way to "get list of all the virtual machines in my vSphere cloud" leaving Jenkins aside? – MaratC Mar 22 '20 at 11:04
  • Yes, using the PowerCli command Get-VM: https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.powercli.cmdletref.doc%2FGet-VM.html – Mor Vino Mar 24 '20 at 06:48

2 Answers2

0

Solved by executing powershell script (using the jenkins powershell plugin) that use vSphere PowerCLI command:

Get-VM

VMware Get-VM

Mor Vino
  • 85
  • 7
0

If you want a *nix alternative, GOVC's find command is also useful:

govc find . -type m
Matthew Frost
  • 578
  • 5
  • 13