Thursday, 18 January 2018

Setting up MPIO with iSCSI on Server 2012/2016 via Powershell

MPIO (in regards in iSCSI) in Windows Server allows us to utilise two or more connectors rather than using a single connector to hook up to our storage appliance.

By default MPIO is not installed / enabled on Server 2012/2016 - so we'll firstly enable it with:

Enable-WindowsOptionalFeature –Online –FeatureName MultiPathIO

To enable automatic use of MPIO we should issue:

Enable-MSDSMAutomaticClaim -BusType iSCSI

and then set the load balancing type we'll want to use with it (in this case we'll use a round robin style):

Set-MSDSMGlocalDefaultLoadBalancePolicy -Policy RR

and finally set the disk timeout period used for MPIO:

Set-MPIOSetting -NewDiskTimeout 45

And reboot the system:

shutdown /r -t 0

Set the interface IP addresses by firstly obtaining the interface index for the relevant ports:


and assign the relevant IP addresses:

New-NetIPAddress -InterfaceIndex <int> -IPAddress -PrefixLength 24

We'll also need to ensure that iSCSI support has been enabled:

Set-Service -Name msiscsi -StartupType Automatic
Start-Service msiscsi

We'll now proceed by configuring our iSCSI connectors via Powershell:

New-IscsiTargetPortal -TargetPortalAddress <SAN-IP-1> -InitiatorPortalAddress <LOCAL-SAN-IP-1> -InitiatorInstanceName "ROOT\ISCSIPRT\0000_0"
New-IscsiTargetPortal -TargetPortalAddress <SAN-IP-2> -InitiatorPortalAddress <LOCAL-SAN-IP-1> -InitiatorInstanceName "ROOT\ISCSIPRT\0000_0"

Now obtain the node address with:


and connect to them with:

Connect-IscsiTarget -IsMultipathEnabled $true -NodeAddress <node-address> -IsPersistent $true
Connect-IscsiTarget -IsMultipathEnabled $true -NodeAddress <node-address> -IsPersistent $true

Then get a list of the disks with:

Get-IscsiSession | Get-Disks


Post a Comment