Reading Disks and Partitions

by Nov 27, 2014

Windows 8.1 / Server 2012 R2

Disk management has been greatly simplified with the many new client and server cmdlets that ship with Windows 8.1 and Server 2012 R2.

Let’s start with looking at disks and partitions. This would list all disks you have mounted:

 
PS> Get-Disk 
 

And this gets you the partitions:

 
PS> Get-Partition 
 

Both cmdlets reside in the module “Storage”:

 
PS> Get-Command -Name Get-Disk | Select-Object -ExpandProperty Module

ModuleType Version    Name                                ExportedCommands        
---------- -------    ----                                ----------------        
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMas... 
 

This will show you all the other storage management commands found there:

 
PS> Get-Command -Module storage

CommandType     Name                                               ModuleName     
-----------     ----                                               ----------     
Alias           Flush-Volume                                       Storage        
Alias           Initialize-Volume                                  Storage        
Alias           Write-FileSystemCache                              Storage        
Function        Add-InitiatorIdToMaskingSet                        Storage        
Function        Add-PartitionAccessPath                            Storage        
Function        Add-PhysicalDisk                                   Storage      
(...)

Twitter This Tip! ReTweet this Tip!