przemol10
Contributor
Contributor

GUI: how to run the same command on multiple VMs at once ?

Jump to solution

Hi,

let's assume we have several operations to do on several VMs (e.g. like Upgrade Virtual Hardware, vmtools install  - but it could be anything else of course ...).

I would like to avoid clicking on each VM (especially when we have hundreds on different clusters).  Is it possible to select somehow

(they are not next to each other) and carry out on particular operation on all selected at once ?

1 Solution

Accepted Solutions
bayupw
Leadership
Leadership

Hi,

If you are using vCenter 5.1+ you can also try to use tagging and assign custom tags on inventory objects.

vSphere 5.5 Documentation Center - Apply a Tag to an Object

tagging.jpg

Search for objects by that tag.

If you want to use PowerCLI 5.5, you can also search for inventory by that tag.

Get-VM -Tag <TagName> which will list all VMs with that <TagName>

Here are some links to get started with vSphere PowerCLI

Back to Basics: Part 1 - Installing PowerCLI | VMware PowerCLI Blog - VMware Blogs

vSphere PowerCLI Documentation

Bayu Wibowo | VCIX6-DCV/NV Author of VMware NSX Cookbook http://bit.ly/NSXCookbook https://github.com/bayupw/PowerNSX-Scripts https://nz.linkedin.com/in/bayupw | twitter @bayupw

View solution in original post

7 Replies
homerzzz
Hot Shot
Hot Shot

I'll throw out a few ideas...you can group VMs into folders and perform any Update manager commands against the folders, you can also script commands (I know you asked about GUI) against these folders.

I'll be interested to see others comments also.

bayupw
Leadership
Leadership

As homerz mentioned, you can group these VMs into folders.

In GUI e.g. vSphere Clients you can select a folder/host/cluster/datacenter.

Then you select the virtual machines tab on the right.

From there you can select multiple VMs by holding shift for example, then right click, then you can perform operations on multiple VMs selected such as power on, power off, vMotion, Storage vMotion, but not all operations are supported.

If you want to perform more complex operations you can use PowerCLI or vCenter Orchestrator.

Bayu Wibowo | VCIX6-DCV/NV Author of VMware NSX Cookbook http://bit.ly/NSXCookbook https://github.com/bayupw/PowerNSX-Scripts https://nz.linkedin.com/in/bayupw | twitter @bayupw
0 Kudos
vThinkBeyondVM
VMware Employee
VMware Employee

This should be possible through VC SDK, connect to VC, connect to host, arrayList of all VMs objects (Managed object reference). Then iterate through all VMs object and execute needed command.

Explore: VIJAVA open source project (Search in google)

Explore: VIX APIs by VMware

If it is useful, plz mark answer as correct or helpful. ---------------------------------------------------------------- Thanks & Regards Vikas, VCP50, MCTS on AD, SCJP6.0. http://vThinkBeyondVM.com ----------------------------------------------------------------- Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.
0 Kudos
przemol10
Contributor
Contributor

Hi all,

thank you for you all answers. Currently we have all these VMs (a lot ...) grouped into a folders and I am afraid I might be lost if I move them all (again: a lot ...) to a new folder.

Then I will have to move them back and might .... cause havoc 😉 (I mean they won't get back to their original directory).

I hoped that GUI/WebUI (we use ESX 5.5) might have a feature where I could easily have them displayed without changing anything in existing infrastructure.

It seems that the only way to cope with it (and not buy any special software ...) is to use any sort of CLI.

Since I am Linux/Python guy is there any way to have it sorted using Linux + Python (it would be the easiest for me ...) ?

Or maybe just Linux (no necessary Python) where I could write my own scripts ?

0 Kudos
bayupw
Leadership
Leadership

Hi,

If you are using vCenter 5.1+ you can also try to use tagging and assign custom tags on inventory objects.

vSphere 5.5 Documentation Center - Apply a Tag to an Object

tagging.jpg

Search for objects by that tag.

If you want to use PowerCLI 5.5, you can also search for inventory by that tag.

Get-VM -Tag <TagName> which will list all VMs with that <TagName>

Here are some links to get started with vSphere PowerCLI

Back to Basics: Part 1 - Installing PowerCLI | VMware PowerCLI Blog - VMware Blogs

vSphere PowerCLI Documentation

Bayu Wibowo | VCIX6-DCV/NV Author of VMware NSX Cookbook http://bit.ly/NSXCookbook https://github.com/bayupw/PowerNSX-Scripts https://nz.linkedin.com/in/bayupw | twitter @bayupw

View solution in original post

przemol10
Contributor
Contributor

Bayu,

I think the tags are the best solution so far (without digging into PowerCLI which is new for me ...).

It took me about 15 min to be familiar with it (including saving searches etc).

Quite handy I must admit 🙂

0 Kudos