Wednesday, April 11, 2012

Change storage pathing in ESX5

In ESX4 I used a script to cycle through the available datastore paths and set the connection type to round robin. In ESX5 it changed a bit, so this is the updated script





param([string] $server = $(throw "Server param required")
,$user,$pass)

if ($user -eq $null)
{connect-viserver $server}
else
{connect-viserver $server -User $user -Password $pass}

$esxcli = Get-EsxCli
$esxcli.storage.nmp.path.list() | group-Object -Property Device | where {$_.count -ge 4} |  %{ $esxcli.storage.nmp.device.set($null, $_.Name, "VMW_PSP_RR")}
$esxcli.storage.nmp.satp.set($null, "VMW_PSP_RR", "VMW_SATP_ALUA_CX")

disconnect-viserver $server -confirm:$false

No comments: