VI Toolkit Advanced Script: Set-MultipathPolicy

Quick Tip: Check out my script for setting the multipath policy on a lun.

I am planning to write an elaborate post on unleashing the complete power of the Virtual Center API using PowerShell soon! Stay Tuned!

function Set-MultipathPolicy




# Created by Hugo Peeters, JUNE 2008

# Description: Sets the multipath policy for a specified LUN

# EXAMPLE: Set-MultipathPolicy -VMHost “” -lunId “vmhba1:0:102” -PolicyName “mru”

# Possible values for PolicyName: fixed, mru, rr


# Create filter for selecting the ESX host

$nvc = New-Object System.Collections.Specialized.NameValueCollection



# Link to host system

$HostSystem = Get-EntityView -ViewType HostSystem -Filter $nvc


# Link to host storage system

$HostStorageSystem = Get-View -MoRef $HostSystem.ConfigManager.StorageSystem


# create object for input to method

$policy = New-Object Vmware.Vim.HostMultipathInfoLogicalUnitPolicy


# set object properties

$policy.policy = $PolicyName


# Execute method




One thought on “VI Toolkit Advanced Script: Set-MultipathPolicy”

Leave a Reply