powershell

My most frequently used PowerCLI One-liner

Over the last months I wrote different PowerCLI One-liners who I want to share. Nothing fancy and one or two are ugly. But they worked for me. :) Changing the multipathing policy for all hosts and datastores in a cluster Get-Cluster PROD | Get-VMhost | Get-scsiLun -CanonicalName “naa.60030*”| Set-ScsiLun -MultipathPolicy "roundrobin" 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