Powercli : One-liners
Over the last few months I started learning Powercli and wrote different PowerCLI One-liners while working. I will add more in the list later on by updating this post. - Get all VM names with powerstat in a cluster and export result to a csv :- Get-Cluster mycluster| Get-VM | select Name, PowerState |Export-CSV 'C:\Users\aj\Desktop\test.csv' - Get a list of all VMs in a cluster and the datastore in which the VMs resides Get-Cluster | Get-VM | select name, @{N="Datastore";E={Get-Datastore -VM $_}} | sort name - Get poweron VM names :- Get-VM | select name,powerstate | ?{$_.powerstat -match "PowerON"} - Get vmware tools status :- Get-vm |% { get-view $_.id } | select Name, @{ Name=”Tools Status”; Expression={$_.guest.toolsstatus}}, @{ Name=”Tools Runnin...