Managing MPIO with Windows PowerShell on Windows Server 2012

Installing and Managing MPIO using PowerShell:

This post is intended as an overview of capabilities present in the MPIO module for managing MPIO on Windows Server 2012.

Note: The MPIO feature is available on Windows Server 2012 versions only.

Use of the MPIO module in Windows PowerShell requires an “elevated” PowerShell window, opened with Administrator privileges.


Query the installation state of MPIO:

To determine if MPIO is currently installed, use the following command:

Get-WindowsOptionalFeature –Online –FeatureName MultiPathIO

 

clip_image002

 

Enable or Disable the MPIO Feature:

If the MPIO feature is not currently installed, use the following command to enable the MPIO feature:

Enable-WindowsOptionalFeature –Online –FeatureName MultiPathIO

 

clip_image004

 

To disable the MPIO feature, use the following command:

Disable-WindowsOptionalFeature –Online –FeatureName MultiPathIO

 

Listing commands available in the MPIO module:
The commands available in the MPIO module can be listed using get-command as shown below

Note: Not all of these cmdlets are available in the Release Preview.

 

clip_image007

Full help and example content for the MPIO module is available via the following method:

  • In PowerShell, after importing the MPIO module or using any MPIO cmdlet, updated help can be downloaded from the internet by running the following command:
    • Update-Help

Obtaining additional PowerShell help and examples

For a complete list of available PowerShell cmdlets in the MPIO module, including usage and examples, please refer to the following TechNet site:

MPIO Cmdlets in Windows PowerShell
https://technet.microsoft.com/library/hh826113.aspx

You can also obtain help for individual commands by specifying the cmdlet with Get-Help, such as shown below:

Get-Help Get-MPIOAvailableHW

clip_image009



Obtaining and updating help for Windows PowerShell cmdlets

In Windows 8, PowerShell modules which ship with Windows do not include help content “in-box” instead this content is provided on the Internet, and may be updated via PowerShell from a computer which has Internet access.

Once a PowerShell module has been imported into the current PowerShell session, the help content may be downloaded and updated via the following command:

Update-Help

Note: the –Force parameter must be used if attempting to update more than once per 24 hour period.

The get-help cmdlet offers multiple levels of verbosity, which include

  • No switch specified, only basic help is returned.
  • Detailed provides detailed help
  • Example provides examples of the cmdlet in use.
  • Full provides all available help content for the specified cmdlet.

For example, in order to obtain script examples for the Get-MPIOAvailableHW cmdlet, the following command is utilized:

Get-Help Get-MPIOAvailableHW –Examples

clip_image011

Script Example: Configuring MPIO using PowerShell:

In this example, I wish to perform the following tasks:

Tip: If these steps are performed prior to connecting devices of the desired BusType, you can typically avoid the need for a restart.

  • Install the MPIO feature on a new Windows Server 2012 installation.
  • Configure MPIO to automatically claim all iSCSI devices.
  • Configure the default Load Balance policy for Round Robin.
  • Set the Windows Disk timeout to 60 seconds.

Here is what this script would look like:

image



Scripting the Configuration of MPIO Timer Values

Timers for MPIO can be managed using the Get-MPIOSetting and Set-MPIOSetting PowerShell cmdlets:

Example: Viewing the current MPIO settings.

clip_image012



Additional References:

MPIO PowerShell cmdlets list and help documentation:
https://technet.microsoft.com/library/hh826113.aspx