<# Get-MPIOSetting Output with Best Practices
PS C:> Get–MPIOSetting
PathVerificationState : Disabled
PathVerificationPeriod : 30
PDORemovePeriod : 30
RetryCount : 3
RetryInterval : 1
UseCustomPathRecoveryTime : Enabled
CustomPathRecoveryTime : 20
DiskTimeoutValue : 60
#>
switch ((Get–CimInstance Win32_OperatingSystem).version) {
6.3.9600 {
Write–Host “Windows 2012 R2 — Current MPIO Settings for $($env:COMPUTERNAME)”
$MPIO = $null
$MPIO = Get–MPIOSetting | Out–String
$MPIO.Replace(” “,“”)
$PathVerificationState = $MPIO.Substring(32,8)
$PDORemovePeriod = $MPIO.Substring(101,2)
$UseCustomPathRecoveryTime = $MPIO.Substring(195,8)
$CustomPathRecoveryTime = $MPIO.Substring(232,2)
$DiskTimeOutValue = $MPIO.Substring(264,2)
if($PathVerificationState –eq ‘Disabled’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: PathVerificationState is $($PathVerificationState).”
$resp = Read–Host “REQUIRED ACTION: Set the PathVerificationState to Enabled?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewPathVerificationState Enabled
} else {
Write–Host “WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: PathVerificationState is Enabled. No action required.”
}
if($PDORemovePeriod –ne ’30’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: PDORemovePeriod is set to $($PDORemovePeriod).”
$resp = Read–Host “REQUIRED ACTION: Set the PDORemovePeriod to 30?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewPDORemovePeriod 30
} else {
Write–Host “WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: PDORemovePeriod is set to 30. No action required.”
}
if($UseCustomPathRecoveryTime –eq ‘Disabled’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime).”
$resp = Read–Host “REQUIRED ACTION: Set the UseCustomPathRecoveryTime to Enabled?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –CustomPathRecovery Enabled
} else {
Write–Host “WARNING: Not changing the UseCustomPathRecoveryTime to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
#Write-Host “: UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime). No action required.”
Write–Host “: UseCustomPathRecoveryTime is set to Enabled. No action required.”
}
if($CustomPathRecoveryTime –ne ’20’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: CustomPathRecoveryTime is set to $($CustomPathRecoveryTime).”
$resp = Read–Host “REQUIRED ACTION: Set the CustomPathRecoveryTime to 20?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –CustomPathRecovery Enabled
} else {
Write–Host “WARNING: Not changing the CustomPathRecoveryTime to 20 could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: CustomPathRecoveryTime is set to $($CustomPathRecoveryTime). No action required.”
}
if($DiskTimeOutValue –ne ’60’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: DiskTimeOutValue is set to $($DiskTimeOutValue).”
$resp = Read–Host “REQUIRED ACTION: Set the DiskTimeOutValue to 60?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewDiskTimeout 60
} else {
Write–Host “WARNING: Not changing the DiskTimeOutValue to 60 could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: DiskTimeOutValue is set to $($DiskTimeOutValue). No action required.”
}
} # Windows 2012 R2
10.0.14393 {
Write–Host “Windows 2016”
$MPIO = Get–MPIOSetting | Out–String
$MPIO.Trim()
$MPIO.Replace(” “,“”)
$PathVerificationState = $MPIO.Substring(32,8)
$PDORemovePeriod = $MPIO.Substring(102,2)
$UseCustomPathRecoveryTime = $MPIO.Substring(196,8)
$CustomPathRecoveryTime = $MPIO.Substring(233,2)
$DiskTimeOutValue = $MPIO.Substring(265,2)
if($PathVerificationState –eq ‘Disabled’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: PathVerificationState is $($PathVerificationState).”
$resp = Read–Host “REQUIRED ACTION: Set the PathVerificationState to Enabled?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewPathVerificationState Enabled
} else {
Write–Host “WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: PathVerificationState is Enabled. No action required.”
}
if($PDORemovePeriod –ne ’30’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: PDORemovePeriod is set to $($PDORemovePeriod).”
$resp = Read–Host “REQUIRED ACTION: Set the PDORemovePeriod to 30?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewPDORemovePeriod 30
} else {
Write–Host “WARNING: Not changing the PathVerificationState to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: PDORemovePeriod is set to 30. No action required.”
}
if($UseCustomPathRecoveryTime –eq ‘Disabled’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime).”
$resp = Read–Host “REQUIRED ACTION: Set the UseCustomPathRecoveryTime to Enabled?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –CustomPathRecovery Enabled
} else {
Write–Host “WARNING: Not changing the UseCustomPathRecoveryTime to Enabled could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
#Write-Host “: UseCustomPathRecoveryTime is set to $($UseCustomPathRecoveryTime). No action required.”
Write–Host “: UseCustomPathRecoveryTime is set to Enabled. No action required.”
}
if($CustomPathRecoveryTime –ne ’20’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: CustomPathRecoveryTime is set to $($CustomPathRecoveryTime).”
$resp = Read–Host “REQUIRED ACTION: Set the CustomPathRecoveryTime to 20?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –CustomPathRecovery Enabled
} else {
Write–Host “WARNING: Not changing the CustomPathRecoveryTime to 20 could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: CustomPathRecoveryTime is set to $($CustomPathRecoveryTime). No action required.”
}
if($DiskTimeOutValue –ne ’60’) {
Write–Host “FAILED” –ForegroundColor Red –NoNewline
Write–Host “: DiskTimeOutValue is set to $($DiskTimeOutValue).”
$resp = Read–Host “REQUIRED ACTION: Set the DiskTimeOutValue to 60?”
if ($resp.ToUpper() –eq ‘Y’) {
Set–MPIOSetting –NewDiskTimeout 60
} else {
Write–Host “WARNING: Not changing the DiskTimeOutValue to 60 could cause unexpected path recovery issues.” –ForegroundColor Yellow
}
} else {
Write–Host “PASSED” –ForegroundColor Green –NoNewline
Write–Host “: DiskTimeOutValue is set to $($DiskTimeOutValue). No action required.”
}
} # Windows 2016
}