Get-LocalDisk

Description

Get-LocalDisk will provide you the information of a local disk on a computer running on a Windows operating system.

Note: You need to install SysInfo module in order for this cmdlet to be available. For more information, see PowerShell Module SysInfo.

Syntax:

Get-LocalDisk [[-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-LocalDisk

Output:

Now lets see few examples about Get-LocalDisk .

[adinserter name=”In Article”]

Examples

Example 1

This command gets the information from local system.

PS C:\> Get-LocalDisk DeviceID : C: DriveType : Local Disk ProviderName : VolumeName : Size : 240054693888 FreeSpace : 79968514048 FreeSpacePercentage : 33 SystemName : LOCALPC DeviceID : E: DriveType : Local Disk ProviderName : VolumeName : Progs Size : 120031539200 FreeSpace : 49103392768 FreeSpacePercentage : 41 SystemName : LOCALPC DeviceID : F: DriveType : Local Disk ProviderName : VolumeName : Data Size : 1000097181696 FreeSpace : 981623255040 FreeSpacePercentage : 98 SystemName : LOCALPC

Example 2

This command gets the information from Server1.

PS C:\> Get-LocalDisk -ComputerName Server1 DeviceID : C: DriveType : Local Disk ProviderName : VolumeName : Size : 106818433024 FreeSpace : 31742431232 FreeSpacePercentage : 30 SystemName : Server1

Example 3

This command gets the information from remote system with IP 192.168.0.5.

PS C:\> Get-LocalDisk -ComputerName "192.168.0.5" DeviceID : C: DriveType : Local Disk ProviderName : VolumeName : Size : 106818433024 FreeSpace : 31742431232 FreeSpacePercentage : 30 SystemName : Server1

Example 4

This command gets the information from Server1, Server2 and Server3.

PS C:\> Get-LocalDisk -ComputerName Server1,Server2,Server3

Example 5

This command gets the information from Server1 and will output only Name and Status Properties.

PS C:\> Get-LocalDisk -ComputerName Server1 -Properties Name,Status

Example 6

This command gets the information from Server1 and will output all properties.

PS C:\> Get-LocalDisk -ComputerName Server1 -Properties * Caption : C: Description : Local Fixed Disk InstallDate : Name : C: Status : Availability : ConfigManagerErrorCode : ConfigManagerUserConfig : DeviceID : C: ErrorCleared : ErrorDescription : LastErrorCode : PowerManagementCapabilities : PowerManagementSupported : StatusInfo : SystemName : Server1 Access : BlockSize : ErrorMethodology : NumberOfBlocks : Purpose : FreeSpace : 31742353408 Size : 106818433024 Compressed : False DriveType : Local Disk FileSystem : NTFS MaximumComponentLength : 255 MediaType : Fixed hard disk media ProviderName : QuotasDisabled : True QuotasIncomplete : False QuotasRebuilding : False SupportsDiskQuotas : True SupportsFileBasedCompression : True VolumeDirty : False VolumeName : VolumeSerialNumber : 026C38DA FreeSpacePercentage : 30 UsedSpacePercentage : 70 SizeKB : 104314876 SizeMB : 101870 SizeGB : 99.48 FreeSpaceKB : 30998392 FreeSpaceMB : 30271.87 FreeSpaceGB : 29.56

Example 7

This command gets the information from Server1.

PS C:\> "Server1" | Get-LocalDisk

Example 8

This command gets the information from Server1 using DCOM protocol.

PS C:\> Get-LocalDisk -ComputerName Server1 -Protocol DCOM

[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-LocalDisk can accept a string value to determine the ComputerName parameter.

Outputs

System.Object.

Get-LocalDisk returns an object containing all the information that has been retrieved.

[adinserter name=”In Article”]

Related Links

[adinserter name=”Matched-Content”]