Tag: Get-VM

PowerCLI: Search VM By MAC Address

PowerCLI: Search VM By MAC Address

The below snippet is pretty useful for when you have a mac address conflict between your VM’s. The VMware alarm/flag does not tell you the VM that it MAC conflicts with so time to open up PowerCLI and run the below example


Get-VM | Get-NetworkAdapter | Where {$_.MacAddress -eq “00:59:59:c9:da:9a”} | select @{Name="VM";Expression={$_.Parent}},MacAddress | ft -AutoSize


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