Here is a small script to set the MPIO Policy via Powershell according to Microsofts Best Practices for Storage Spaces as seen here https://technet.microsoft.com/library/0923b851-eb0a-48ee-bfcb-d584363be668
It will set the Global MPIO policy to Least Block and then change the MPIO Policy for all SSD’s to Round Robin. Though, it’s possible that mpclaim.exe will use a different DiskID from what Powershell/Device Manager is using.
So the script has a built-in feature to adjust the DiskId if needed, though you have to verify and set the value manually before running the script!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# As you can see in the ForEach section I had to subtract -1 from the DiskID to make the DiskIDs right. # It's because mpclaim can only see MPIO Disks, and will not see the OS Disk (that Powershell lists) # You need to verify this manually before running the script like this: # # 1. Open DeviceManager # 2. Locate one random SSD # 3. Manually change MPIO Policy to Round Robin # Select Details Tab # Select "Physical Device Object Name" in the dropdrown list. # Take note of the DiskId # Click OK # 4. Run this command line: # mpclaim -s -d | findstr /i /c:RR # Take note of the DiskId # 5. Compare the Numbers from #3 and #4. How much do they differ? # # When I wrote this script, the numbers in this environment differed -1 (mpclaim was 24 and DeviceManger was 25). # So I adjusted the script below to reduce the number by -1. # # While in another environment the Numbers between DeviceManager and mpclaim matched. So no need to subract. # Adjust $subtract below accordingly to the test above. ################# # # Set Global MPIO Policy to Least Blocks according to Microsoft Best Practices Set-MSDSMGlobalDefaultLoadBalancePolicy –policy LB # Get all SSD Drives $ssds = Get-PhysicalDisk | where MediaType -EQ SSD foreach ($ssd in $ssds) { $subtract = "1" # set to 0 if numbers match in the test above. $id = (($ssd.DeviceId) -$subtract).ToString() # Set Policy to Round Robin = 2 start-process "c:\windows\system32\mpclaim.exe" -ArgumentList "-l -d $id 2" -Wait } Write-Output "Show all Drives with Round Robin MPIO Policy" c:\windows\system32\mpclaim.exe -s -d | findstr /i /c:RR |
Tjena Marcus. Bra post. Hittade ett sätt att räkna ut MPIO disk ID dynamiskt.
/Simon
$ssds | %{
# Get disk uniqueid
Write-Output “Physical Disk Unique ID:”
$UniqueID = $_.UniqueId
$MPIODisk = (gwmi -Namespace root\wmi -Class mpio_disk_info).driveinfo | ?{$_.SerialNumber -eq $UniqueID}
Write-Output “MPIO Disk:”
$MPIODiskID = $MPIODisk.Name.Replace(“MPIO Disk”,””)
$MPIODiskID
$ArgumentList = “-l -d $MPIODisk 2”
start-process “c:\windows\system32\mpclaim.exe” -ArgumentList $ArgumentList -Wait
}