Get-DiskPartition
Description
Get-DiskPartition will provide you the information of the capabilities and management capacity of a partitioned area of a physical disk on a computer system running Windows.
Note: You need to install SysInfo module in order for this cmdlet to be available. For more information, see PowerShell Module SysInfo.
Syntax:
Get-DiskPartition [[-ComputerName] <String[]>] [[-Protocol] <String>] [[-Properties] <String[]>] [<CommonParameters>]
Requirements
- SysInfo PowerShell Module
- WinRM Enabled and PowerShell 3.0 (only if you use WinRM protocol)
If you want to find more about the specific cmdlet while you are in PowerShell you can use the below to get the help file.
Code:
Get-Help Get-DiskPartition
Output:
Now lets see few examples about Get-DiskPartition
.
[adinserter name=”In Article”]
Examples
Example 1
This command gets the information from local system.
PS C:\> Get-DiskPartition Name : Disk #0, Partition #0 NumberOfBlocks : 468856832 BootPartition : False PrimaryPartition : True Size : 240054697984 Index : 0 SystemName : LOCALPC Name : Disk #1, Partition #0 NumberOfBlocks : 1953314816 BootPartition : True PrimaryPartition : True Size : 1000097185792 Index : 0 SystemName : LOCALPC Name : Disk #2, Partition #0 NumberOfBlocks : 234436608 BootPartition : False PrimaryPartition : True Size : 120031543296 Index : 0 SystemName : LOCALPC
Example 2
This command gets the information from Server1.
PS C:\> Get-DiskPartition -ComputerName Server1 Name : Disk #0, Partition #0 NumberOfBlocks : 614400 BootPartition : False PrimaryPartition : False Size : 314572800 Index : 0 SystemName : Server1 Name : Disk #0, Partition #1 NumberOfBlocks : 202752 BootPartition : True PrimaryPartition : True Size : 103809024 Index : 1 SystemName : Server1 Name : Disk #0, Partition #2 NumberOfBlocks : 208629760 BootPartition : False PrimaryPartition : True Size : 106818437120 Index : 2 SystemName : Server1
Example 3
This command gets the information from remote system with IP 192.168.0.5.
PS C:\> Get-DiskPartition -ComputerName "192.168.0.5" Name : Disk #0, Partition #0 NumberOfBlocks : 614400 BootPartition : False PrimaryPartition : False Size : 314572800 Index : 0 SystemName : Server1 Name : Disk #0, Partition #1 NumberOfBlocks : 202752 BootPartition : True PrimaryPartition : True Size : 103809024 Index : 1 SystemName : Server1 Name : Disk #0, Partition #2 NumberOfBlocks : 208629760 BootPartition : False PrimaryPartition : True Size : 106818437120 Index : 2 SystemName : Server1
Example 4
This command gets the information from Server1, Server2 and Server3.
PS C:\> Get-DiskPartition -ComputerName Server1,Server2,Server3 | Format-Table Name NumberOfBlocks BootPartition PrimaryPartition Size Index SystemName ---- -------------- ------------- ---------------- ---- ----- ---------- Disk #0, Partition #0 204800 True True 104857600 0 Server3 Disk #0, Partition #0 716800 True True 367001600 0 Server2 Disk #0, Partition #0 614400 False False 314572800 0 Server1 Disk #0, Partition #1 209504256 False True 107266179072 1 Server3 Disk #0, Partition #1 167049216 False True 85529198592 1 Server2 Disk #0, Partition #1 202752 True True 103809024 1 Server1 Disk #0, Partition #2 208629760 False True 106818437120 2 Server1
Example 5
This command gets the information from Server1 and will output only Name and Status Properties.
PS C:\> Get-DiskPartition -ComputerName Server1 -Properties Name,Status Name Status ---- ------ Disk #0, Partition #0 Disk #0, Partition #1 Disk #0, Partition #2
Example 6
This command gets the information from Server1 and will output all properties.
PS C:\> Get-DiskPartition -ComputerName Server1 -Properties * Caption : Disk #0, Partition #0 Description : GPT: Unknown InstallDate : Name : Disk #0, Partition #0 Status : Availability : ConfigManagerErrorCode : ConfigManagerUserConfig : DeviceID : Disk #0, Partition #0 ErrorCleared : ErrorDescription : LastErrorCode : PowerManagementCapabilities : PowerManagementSupported : StatusInfo : SystemName : Server1 Access : BlockSize : 512 ErrorMethodology : NumberOfBlocks : 614400 Purpose : Bootable : False PrimaryPartition : False BootPartition : False DiskIndex : 0 HiddenSectors : Index : 0 RewritePartition : Size : 314572800 StartingOffset : 1048576 Type : GPT: Unknown SizeKB : 307200 SizeMB : 300 SizeGB : 0.29 StartingOffsetKB : 1024 StartingOffsetMB : 1 Caption : Disk #0, Partition #1 Description : GPT: System InstallDate : Name : Disk #0, Partition #1 Status : Availability : ConfigManagerErrorCode : ConfigManagerUserConfig : DeviceID : Disk #0, Partition #1 ErrorCleared : ErrorDescription : LastErrorCode : PowerManagementCapabilities : PowerManagementSupported : StatusInfo : SystemName : Server1 Access : BlockSize : 512 ErrorMethodology : NumberOfBlocks : 202752 Purpose : Bootable : True PrimaryPartition : True BootPartition : True DiskIndex : 0 HiddenSectors : Index : 1 RewritePartition : Size : 103809024 StartingOffset : 315621376 Type : GPT: System SizeKB : 101376 SizeMB : 99 SizeGB : 0.1 StartingOffsetKB : 308224 StartingOffsetMB : 301 Caption : Disk #0, Partition #2 Description : GPT: Basic Data InstallDate : Name : Disk #0, Partition #2 Status : Availability : ConfigManagerErrorCode : ConfigManagerUserConfig : DeviceID : Disk #0, Partition #2 ErrorCleared : ErrorDescription : LastErrorCode : PowerManagementCapabilities : PowerManagementSupported : StatusInfo : SystemName : Server1 Access : BlockSize : 512 ErrorMethodology : NumberOfBlocks : 208629760 Purpose : Bootable : False PrimaryPartition : True BootPartition : False DiskIndex : 0 HiddenSectors : Index : 2 RewritePartition : Size : 106818437120 StartingOffset : 553648128 Type : GPT: Basic Data SizeKB : 104314880 SizeMB : 101870 SizeGB : 99.48 StartingOffsetKB : 540672 StartingOffsetMB : 528
Example 7
This command gets the information from Server1.
PS C:\> "Server1" | Get-DiskPartition Name : Disk #0, Partition #0 NumberOfBlocks : 614400 BootPartition : False PrimaryPartition : False Size : 314572800 Index : 0 SystemName : Server1 Name : Disk #0, Partition #1 NumberOfBlocks : 202752 BootPartition : True PrimaryPartition : True Size : 103809024 Index : 1 SystemName : Server1 Name : Disk #0, Partition #2 NumberOfBlocks : 208629760 BootPartition : False PrimaryPartition : True Size : 106818437120 Index : 2 SystemName : Server1
Example 8
This command gets the information from Server1 using DCOM protocol.
PS C:\> Get-DiskPartition -ComputerName Server1 -Protocol DCOM Name : Disk #0, Partition #0 NumberOfBlocks : 614400 BootPartition : False PrimaryPartition : False Size : 314572800 Index : 0 SystemName : Server1 Name : Disk #0, Partition #1 NumberOfBlocks : 202752 BootPartition : True PrimaryPartition : True Size : 103809024 Index : 1 SystemName : Server1 Name : Disk #0, Partition #2 NumberOfBlocks : 208629760 BootPartition : False PrimaryPartition : True Size : 106818437120 Index : 2 SystemName : Server1
[adinserter name=”In Article”]
Optional Parameters
-ComputerName
- Description: Specifies the computer names or IP Addresses of the systems that we want to get the information from.
- Required: False
- Position: 1
- Default value: None
- Accept pipeline input: True (ByValue)
- Accept wildcard characters: False
-Protocol
- Description: Specifies the protocol that will be used to get the information from the remote system.
- Accepted Values: DCOM or WinRM
- Required: False
- Position: 2
- Default value: None
- Accept pipeline input: False
- Accept wildcard characters: False
-Properties
- Description: Specifies the object properties that appear in the display and the order in which they appear. Wildcards are permitted.
- Required: False
- Position: 3
- Default value
- Accept pipeline input: False
- Accept wildcard characters: True
Inputs
System.Array.
Get-DiskPartition can accept a string value to determine the ComputerName parameter.
Outputs
System.Object.
Get-DiskPartition returns an object containing all the information that has been retrieved.
[adinserter name=”In Article”]
Related Links
- Get-1394Controller
- Get-BaseBoard
- Get-Battery
- Get-BIOS
- Get-Bus
- Get-CacheMemory
- Get-CDROMDrive
- Get-CompactDisc
- Get-Desktop
- Get-DesktopMonitor
- Get-DiskDrive
- Get-Fan
- Get-FloppyController
- Get-FloppyDrive
- Get-GlidePoint
- Get-HeatPipe
- Get-IDEController
- Get-InfraredDevice
- Get-Keyboard
- Get-LocalDisk
- Get-LogicalDisk
- Get-MemoryArray
- Get-MemoryDevice
- Get-MotherboardDevice
- Get-Mouse
- Get-NetworkAdapter
- Get-NetworkAdapterConfiguration
- Get-NetworkDrive
- Get-OperatingSystem
- Get-OpticalSensor
- Get-PhysicalMemory
- Get-PhysicalMemoryArray
- Get-PointingDevice
- Get-PortableBattery
- Get-PrinterConfiguration
- Get-PrinterInfo
- Get-Processor
- Get-RAMDisk
- Get-Refrigeration
- Get-RemovableDisk
- Get-SCSIController
- Get-SoundDevice
- Get-SystemEnclosure
- Get-TapeDrive
- Get-TemperatureProbe
- Get-TouchPad
- Get-TouchScreen
- Get-TrackBall
- Get-TrackPoint
- Get-USBController
- Get-VideoController
- Get-VoltageProbe
- PowerShell Gallery | SysInfo
- GitHub – SConstantinou/SysInfo
- PowerShell Module SysInfo
[adinserter name=”Matched-Content”]


Leave a Reply