VMware Cloud Community
tomtom1
Enthusiast
Enthusiast

Powershell script to change the Path Policy w/o MSCS cluster

Hi, I have few clusters that they have MSCS created. Right now, we have to set the path to round robin manually. I would to get a script that asks me about each datastore whether the path can be changed to round robin ? This way, I will not change the MSCS datastore and change the rest of the datastore.

Thanks

Tom

Reply
0 Kudos
4 Replies
Gortee
Hot Shot
Hot Shot

Evening,

It's all about the logic you want to create.  Using powershell this is all possible.  I do something quick and dirty like this via powershell.  I don't want to change the path policy on my boot from san lun's but I do want to change on my shared lun's so I use a mask like this to do it:

Get-Cluster <CLUSTERNAME> | Get-VMhost | Get-ScsiLun -CanonicalName "naa.*" -LunType disk | Set-ScsiLun -MultipathPolicy "RoundRobin"

You can just replace the naa.* with the whole name of the lun to set policy.   This will do it for the whole cluster...

Now with some powershell variables and if statements you could easily choose not to change policy on all lun's but the MSCS..

Just a suggestion.

Thanks,

Joseph Griffiths http://blog.jgriffiths.org @Gortees VCDX-DCV #143
Reply
0 Kudos
ScreamingSilenc

You can also change path policy based on the Host HBA transport protocol.

Get-VMHost | Get-VMHostHba -Type "FibreChannel" | Get-ScsiLun -LunType "disk" | where {$_.MultipathPolicy -ne "RoundRobin"} | Set-ScsiLun -MultipathPolicy RoundRobin

Thanks

Please consider marking this answer "correct" or "helpful" if you found it useful.
Reply
0 Kudos
tomtom1
Enthusiast
Enthusiast

I am not good in powershell. Can it be little easy wherein it gives the datastore name and then we can select whether it can be set to roundrobin OR just ignore the current path policy.

Thanks

Tom

Reply
0 Kudos
tomtom1
Enthusiast
Enthusiast

Any comments ?

Reply
0 Kudos