Tag: VM

PowerCLI: Rename VM Inventory Name

PowerCLI: Rename VM Inventory Name

If you have seen my older post about changing the Windows hostname I have also had the challenge of changing the VM names within the inventory to match. Here is the rather simple solution to do this

set-vm Old-VM-NAME=01 -name 'New-VM-Name=01' -confirm:$false
set-vm Old-VM-NAME=02 -name 'New-VM-Name=02' -confirm:$false
set-vm Old-VM-NAME=03 -name 'New-VM-Name=03' -confirm:$false


PowerCLI: Mass Shutdown of VM’s

PowerCLI: Mass Shutdown of VM’s

When I am working with test and dev VM’s I usually find I need to shut them down from time to time whilst another project is on the go. Instead of using the web vsphere client and pressing the off power button on each I use powercli so that i can save some time. The trick is to name your VM’s properly at the start of the project so for example this is the naming convention I use when making test VM’s


for example an Asterisk project would be named as follows



So first thing i do is make sure that PowerCLI can list the correct VM’s

connect-viserver test-host
get-vm TEST-ASTERISK-PBX* | Format-Table -AutoSize

Then once I can see that it has listed the correct VM’s for shutdown I issue the following command and confirm all

connect-viserver test-host
shutdown-vmguest TEST-ASTERISK-PBX*

And that’s it