PowerShell for Windows Admins

Jan 15 2012   3:43PM GMT

Boot partition



Posted by: Richard Siddaway
Disks, PowerShell v2, WMI

Do you know which disk partition your system boots from?

Its easy to find out

function get-bootpartition {            
[CmdletBinding()]            
param (            
 [parameter(ValueFromPipeline=$true,            
   ValueFromPipelineByPropertyName=$true)]            
 [string]$computername="$env:COMPUTERNAME"            
)            
PROCESS{                
              
  Get-WmiObject -Class Win32_DiskPartition -Filter "BootPartition = $true" -ComputerName $computername            
              
}            
}

 

The filter only returns the partition where BootPartition is set to True

Comment on this Post

Leave a comment: