PowerShell Scripts, Tips, Expert Advices, Forums, and Resources

image rotation

Welcome to PowerShell.com, the educational and community site for Windows PowerShell People. Get a quick overview.

Latest Forum Posts

11-27-2014 - Time stamp in powershell
11-26-2014 - Changing Registry Key values
11-27-2014 - Powershell script for SCCM12

Latest Scripts

11-27-2014 - Active Directory and GPO Import
11-26-2014 - Exports
11-20-2014 - Are my servers online?

Latest Blog Posts

11-27-2014 - The little changes that make a difference
11-27-2014 - Zip-Pshscripts3.ps1
11-27-2014 - Reading Disks and Partitions

Latest Announcements/Events

10-31-2014 - Using PowerShell to download Teched Europe 2014 content
10-15-2014 - Class Dismissed
10-12-2014 - The Case for PowerShell

As a Powershell.com member you will have access to:

  • Daily PowerShell tips written by Microsoft MVPs and other leading Windows PowerShell experts
  • Free Windows PowerShell advice and training provided by Microsoft MVPs and other leading Windows PowerShell experts
  • Access to leading Windows PowerShell blogs
  • A free ebook, Mastering PowerShell, written by Microsoft MVP Dr. Tobias Weltner
PowerTip of the Day

Reading Disks and Partitions

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!

Copyright 2012 PowerShell.com. All rights reserved.