Windows Server 2012 and 2012 R2 introduced a new set of storage cmdlets that provided specific support for disk management, multipath I/O configuration, MSDSM settings and more. These new cmdlets allowed for much simpler scripting which was a great advantage, but at the same time caused some headaches with customers that were running older versions of Windows Server such as 2008 or 2008 R2. The issue was that these new cmdlets were not available in the older versions of Windows Server which meant this took writing script that used Get-WmiObject (aka gwmi) with specific classes such as Win32_LogicalDisk, Win32_DiskDrive or Win32_DiskPartition.
Most (if not all) customers running Microsoft Windows Server run multiple versions which means everyone faces this problem of supporting either one common approach using Get-WmiObject or two sets of scripts using the old and new cmdlets. Some times supporting the two different approaches can be a daunting task so I wanted to put together the command specifics that supports Windows Server 2008 R2 and Windows Server 2012/2012 R2.
The following sections describe the settings that we recommend to our customers when configuring Windows Server. This includes configuring MPIO HW values, formatting volumes, initializing volumes (aka disks) and other tasks. I have mapped out the differences in cmdlets and command line tools between Windows Server 2008 R2 and Windows Server 2012/2012 R2 so that everyone can benefit from understanding the specific commands.
Get Logical Disk & Partition Information
Windows Server 2008 R2 SP1
Get-WmiObject Win32_DiskPartition -ComputerName $env:COMPUTERNAME | select Name, Index, BlockSize, StartingOffset | Format-Table *
Windows Server 2012 or 2012 R2
Get-Partition
Get Installed Windows Hotfixes
Windows Server 2008 R2 SP1
Get-WmiObject -Class Win32_QuickFixEngineering | Select-Object -Property Description, HotFixID, InstalledOn | Format-Table –Autosize
Windows Server 2012 or 2012 R2
Get-Hotfix
Install MultiPath I/O (MPIO)
Windows Server 2008 R2 SP1
Import-Module Servermanager Add-WindowsFeature Multipath-IO
Windows Server 2012 or 2012 R2
Add-WindowsFeature -Name "Multipath-IO"
Configure New MPIO Device
Windows Server 2008 R2 SP1
Start > Run > mpiocpl mpclaim -e mpclaim –i –r –d “PURE FlashArray “ Manually reboot
Note: Format is important including spaces, Vendor=PURE + 4 spaces, ProductId= FlashArray + 6 spaces
Windows Server 2012 or 2012 R2
Get-MSDSMSupportedHW New-MSDSMSupportedHW -ProductId FlashArray -VendorId PURE Restart-Computer
Note: No need for the spaces.
Windows Disk Management
View Pure Storage FlashArray Volumes Only
Windows Server 2008 R2 SP1
Get-WmiObject -Class Win32_DiskDrive | Where-Object { $_.Model -like "PURE*" }| Format-Table –Autosize
Windows Server 2012 or 2012 R2
Get-Disk | Where-Object FriendlyName -like "PURE*"
Rescan for new volumes
Windows Server 2008 R2 SP1 & Windows Server 2012/2012 R2
”rescan” | diskpart
Initialize Newly Added Pure Storage Volumes
Windows Server 2008 R2 SP1
$PureVolumes = gwmi win32_diskdrive | where {$_.model -like "PURE*"} foreach ($disk in $PureVolumes) { $diskID = $disk.index $dpscript = @" select disk $diskID online disk noerr "@ $dpscript | diskpart }
Windows Server 2012 or 2012 R2
Initialize-Disk <DiskNumber>
Create New Partition, Set Mount Point and Format Volume
Windows Server 2008 R2 SP1
$PureVolumes = Get-WmiObject Win32_DiskDrive | where {$_.model -like "PURE FlashArray*"} foreach ($disk in $PureVolumes) { $diskID = $disk.index $dpscript = @" rem Select the Disk. select disk $diskID rem Online the selected disk. online disk rem Convert to GPT, or use MBR. convert gpt rem Create the primary partition. create partition primary rem Assign Drive Letter manually. rem letter=P rem Enable Automount to set Drive Letter automatically. automount enable rem Create a new simple volume. create volume simple rem Quick format the volume with NTFS and set volume label to PURE STORAGE. format fs=ntfs label="PURE STORAGE" quick "@ $dpscript | diskpart }
Windows Server 2012 or 2012 R2
New-Partition -DiskNumber <DiskNumber> –UseMaximumSize –AssignDriveLetter Add-PartitionAccessPath -DiskNumber -PartitionNumber <#> -AccessPath C:\MyMountPoint Format-Volume -DriveLetter <DriveLetter> -FileSystem NTFS
Set SAN Policy
Windows Server 2008 R2 SP1
"SAN Policy=OnlineAll" | diskpart
Windows Server 2012 or 2012 R2
Set-StorageSetting –NewDiskPolicy OnlineAll
Note: When using Windows Server Failover Clustering be sure to keep the default setting of OfflineShared.
Configure MPIO Policies
Display Current MPIO Policies
Windows Server 2008 R2 SP1
mpclaim –s
Windows Server 2012 or 2012 R2
Get-MPIOSetting
Get & Set Recommended MPIO Policy Settings
Windows Server 2008 R2 SP1
(Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\MSDSM\Parameters").RetryInterval Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\MSDSM\Parameters" -Name RetryInterval -Value 20 (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\mpio\Parameters").UseCustomPathRecoveryInterval Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\mpio\Parameters" -Name UseCustomPathRecoveryInterval -Value 1 (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\MSDSM\Parameters").PDORemovePeriod Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\MSDSM\Parameters" -Name PDORemovePeriod -Value 30 (Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\Disk\") Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Services\Disk" -Name TimeOutValue -Value 60
Windows Server 2012 or 2012 R2
Set-MPIOSetting -NewPathRecoveryInterval 20 Set-MPIOSetting -CustomPathRecovery Enabled Set-MPIOSetting -NewPDORemovePeriod 30 Set-MPIOSetting -NewDiskTimeout 60
References
- mpclaim parameters – https://technet.microsoft.com/en-us/library/ee619743%28v=ws.10%29.aspx
- Storage Cmdlets in Windows PowerShell – https://technet.microsoft.com/en-us/library/hh848705.aspx
It is easy to see that the Windows Server 2012/2012 R2 approach is much simpler and less prone to scripting snafus.
Thanks,
barkz