PowerShell makes platform management easy. VMware vSphere PowerCLI has modules and cmdlets that make managing your VMware environment via command line a breeze. Andrew Morgan published a few one-liners to get you started:
Retrieve and Apply DRS recommendations:
get-drsrecommendation | Apply-DrsRecommendation
Find all vm’s with e1000 network cards, for upgrade to vmxnet:
get-vm | Get-NetworkAdapter | where {$_.type -match “e1000″} | select-object parent,networkname,name,type
Power off all vm’s with “test” in their names:
get-vm test* | stop-vm -confirm:$false
Move all vm’s with “test” in their names:
get-vm | where {$_.name -like “*test”} | move-vm -destination destinationhostname
Remove all vm’s with “test” in their name:
get-vm test* | remove-vm -confirm:$false
Retrieve a list of vm’s with thinly provisioned disks:
get-vm | select HardDisks -expandproperty HardDisks | where {$_.storageformat -match “Thin”} | select-object parent,name,capacitykb,filename
Check out Andrew’s article for more information…
Check out VMware’s PowerCLI page…
Technorati : PowerShell, VMware
Del.icio.us : PowerShell, VMware