PowerShell Storage Space Creation Tips

See how to use PowerShell to completely create a Windows Server 2012 R2 Storage Space that also uses tiering.

John Savill

July 21, 2013

2 Min Read
PowerShell Storage Space Creation Tips

Q: Is there a Windows PowerShell script to completely create a Windows Server 2012 R2 Storage Space?

A: Below are the PowerShell commands to create a Windows Server 2012 R2 Storage Space that has HDD and SSD tiers, then creates a virtual disk using both tiers:

#List all disks that can be pooled and output in table format (format-table)           
Get-PhysicalDisk -CanPool $True | ft FriendlyName,OperationalStatus,Size,MediaType           
           
#Store all physical disks that can be pooled into a variable, $pd           
$pd = (Get-PhysicalDisk -CanPool $True | Where MediaType -NE UnSpecified)           
#Create a new Storage Pool using the disks in variable $pd with a name of My Storage Pool           
New-StoragePool -PhysicalDisks $pd –StorageSubSystemFriendlyName “Storage Spaces*” -FriendlyName “My Storage Pool”           
#View the disks in the Storage Pool just created           
Get-StoragePool -FriendlyName "My Storage Pool" | Get-PhysicalDisk | Select FriendlyName, MediaType           
           
#Create two tiers in the Storage Pool created. One for SSD disks and one for HDD disks           
$ssd_Tier = New-StorageTier -StoragePoolFriendlyName "My Storage Pool" -FriendlyName SSD_Tier -MediaType SSD           
$hdd_Tier = New-StorageTier -StoragePoolFriendlyName "My Storage Pool" -FriendlyName HDD_Tier -MediaType HDD           
           
#New-VirtualDisk –SNtoragePoolFriendlyName “My Storage Pool” –ResiliencySettingName Simple –Size 10TB –Provisioningtype Thin –FriendlyName “Documents”            
#Create a new virtual disk in the pool with a name of TieredSpace using the SSD (50GB) and HDD (300GB) tiers           
$vd1 = New-VirtualDisk -StoragePoolFriendlyName "My Storage Pool" -FriendlyName TieredSpace -StorageTiers @($ssd_tier, $hdd_tier) -StorageTierSizes @(50GB, 300GB) -ResiliencySettingName Mirror -WriteCacheSize 1GB   #cannot also specify -size if using tiers and also cannot use provisioning type, e.g. Thin

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like