International Man of Awesome's Blog – When Too Much Awesome Isn't Enough

November 5, 2010

vSphere PowerCLI multipath policy script examples

Filed under: ESX, iSCSI, Storage, Virtualisation, VMware — internationalmanofawesome @ 4:43 pm

Since PowerCLI is the way to go with VMware ESXi, I’ve needed to do some investigation of changing my config script to PowerCLI. Here are some examples of setting multipath policies for iSCSI storage.

 

#Shows the multipath policy for all LUN’s connected to all hosts in Cluster CL01

Get-Cluster CL01 | Get-VMHost | Get-ScsiLun -LunType disk

 

#Shows the multipath policy for all LUN’s connected to host host4

Get-VMHost host4 | Get-ScsiLun -LunType disk

 

#Sets the multipath policy for all HDS LUN’s connected to all hosts in Cluster CL01 to roundrobin

Get-Cluster CL01 | Get-VMHost | Get-ScsiLun -CanonicalName “naa.600*” | Set-ScsiLun -MultipathPolicy “roundrobin”

 

#Sets the multipath policy for all EMC LUN’s connected to host host4

Get-VMHost host4 | Get-ScsiLun -CanonicalName “naa.600*” | Set-ScsiLun -MultipathPolicy “roundrobin”

 

# Output the CanonicalName for all the devices on Cluster Primary that are HDS  type (naa.600*)

Get-Cluster Primary | Get-VMHost | Get-ScsiLun -CanonicalName “naa.600*” | fl -show CanonicalName | out-file c:\shared\naa-id.txt

 

Awesome.. But I can’t take the credit. I mangled these from here, http://runningvm.wordpress.com/2010/08/31/vsphere-powercli-multipath-policy-script-examples/

Create a free website or blog at WordPress.com.