To view disk partitioning information, use WMI:- Get-WmiObject -Class Win32_DiskPartition |
- Select-Object -Property *
复制代码 Next, pick the properties you are really interested in, then replace the "*" with a comma-separated list of these properties. For example:- Get-WmiObject -Class Win32_DiskPartition |
- Select-Object -Property Name, BlockSize, Description, BootPartition
复制代码 If you pick four or less properties, the result is a neat table, otherwise a list:
Name BlockSize Description BootPartition
---- --------- ----------- -------------
Disk #0, Partition #0 512 Installable File System False
Disk #0, Partition #1 512 Installable File System False
Disk #0, Partition #2 512 Installable File System True
|
If you are hungry for more, use the parameter -List to search for other WMI classes, either related to "disk", or just something completely different:
PS> Get-Wmiobject -Class Win32_*Processor* -List
NameSpace: ROOT\cimv2
Name Methods Properties
---- ------- ----------
Win32_Processor {SetPowerState, R... {AddressWidth, Architecture, Availabili...
Win32_ComputerSystemProcessor {} {GroupComponent, PartComponent}
Win32_AssociatedProcessorMemory {} {Antecedent, BusSpeed, Dependent}
Win32_PerfFormattedData_Counters... {} {BuildScatterGatherCyclesPersec, Captio...
Win32_PerfRawData_Counters_PerPr... {} {BuildScatterGatherCyclesPersec, Captio...
Win32_PerfFormattedData_Counters... {} {BuildScatterGatherListCallsPersec, Cap...
Win32_PerfRawData_Counters_PerPr... {} {BuildScatterGatherListCallsPersec, Cap...
Win32_PerfFormattedData_Counters... {} {C1TransitionsPersec, C2TransitionsPers...
Win32_PerfRawData_Counters_Proce... {} {C1TransitionsPersec, C2TransitionsPers...
Win32_PerfFormattedData_PerfOS_P... {} {C1TransitionsPersec, C2TransitionsPers...
Win32_PerfRawData_PerfOS_Processor {} {C1TransitionsPersec, C2TransitionsPers...
|
http://powershell.com/cs/blogs/tips/archive/2013/12/16/finding-disk-partition-details.aspx |