How to query the MPIO policy - Scripting Example

The following script example shows how to query the current load balancing policy for MPIO devices.

Once it successfully runs, it will print out integer values. i.e.) 1, 2, 3, 4, 5, 6, and 7

These values represent the following MPIO policies:

1 "Fail Over Only"

2 "Round Robin",

3 "Round Robin with Subset"

4 "Dynamic Least Queue Depth"

5 "Weighted Paths"

NOTE: The script uses DSM_QueryLBPolicy_V2 class to query the current LB policy setting. The class works on W2K8+ , but it won’t work on W2K3. For W2K3, DSM_QueryLBPolicy has to be used instead.


On Error Resume Next

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

strComputer = "."


   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\WMI")

   Set colItems = objWMIService.ExecQuery("SELECT * FROM DSM_QueryLBPolicy_V2", "WQL", _

                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems

      WScript.Echo "Active: " & objItem.Active

  WScript.Echo "InstanceName: " & objItem.InstanceName

      WScript.Echo "LoadBalancePolicy: " & objItem.LoadBalancePolicy.LoadBalancePolicy