Windows PowerShell is a powerful scripting language that allows users to automate tasks and manage Windows systems. One of the most useful commands is Get-PhysicalDisk, which provides information about physical disks on a computer. In this article, we’ll discuss the syntax, parameters, inputs, outputs, examples, and tips for using Get-PhysicalDisk.
Syntax
The syntax for Get-PhysicalDisk is as follows:
Get-PhysicalDisk [-FriendlyName] [-InputObject] [-CimSession] [-ThrottleLimit] [-AsJob] [-ComputerName] [-ErrorAction] [-ErrorVariable] [-OutVariable] [-OutBuffer] [-PipelineVariable] [-Verbose] [-WarningAction] [-WarningVariable] [
Parameters
The parameters for Get-PhysicalDisk are as follows:
Parameter | Description |
---|---|
FriendlyName | Specifies the friendly name of the physical disk. |
InputObject | Specifies the input object that is used in the command. |
CimSession | Specifies the CIM session that is used in the command. |
ThrottleLimit | Specifies the maximum number of concurrent operations that can be established to run the cmdlet. |
AsJob | Runs the cmdlet as a background job. |
ComputerName | Specifies the computer name that is used in the command. |
ErrorAction | Specifies how the cmdlet responds when an error occurs. |
ErrorVariable | Specifies the variable in which the error is stored. |
OutVariable | Specifies the variable in which the output is stored. |
OutBuffer | Specifies the number of objects to be written to the output buffer. |
PipelineVariable | Specifies the variable that is used in the pipeline. |
Verbose | Displays detailed information about the cmdlet. |
WarningAction | Specifies how the cmdlet responds when a warning occurs. |
WarningVariable | Specifies the variable in which the warning is stored. |
CommonParameters | This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters. |
Inputs
The inputs for Get-PhysicalDisk are as follows:
- FriendlyName
- InputObject
- CimSession
- ThrottleLimit
- AsJob
- ComputerName
- ErrorAction
- ErrorVariable
- OutVariable
- OutBuffer
- PipelineVariable
- Verbose
- WarningAction
- WarningVariable
- CommonParameters
Outputs
The outputs for Get-PhysicalDisk are as follows:
- System.Management.Automation.PSObject
Examples
The following example shows how to use Get-PhysicalDisk to get information about physical disks on a computer:
Get-PhysicalDisk | Format-Table FriendlyName, Size, MediaType
The following example shows how to use Get-PhysicalDisk to get information about a specific physical disk on a computer:
Get-PhysicalDisk -FriendlyName “Disk 0” | Format-Table FriendlyName, Size, MediaType
Tips
Here are some tips for using Get-PhysicalDisk:
- Use the FriendlyName parameter to get information about a specific physical disk.
- Use the Format-Table cmdlet to format the output of Get-PhysicalDisk.
- Use the ThrottleLimit parameter to limit the number of concurrent operations.
- Use the AsJob parameter to run the cmdlet as a background job.
- Use the ComputerName parameter to specify the computer name.
- Use the ErrorAction, ErrorVariable, OutVariable, OutBuffer, PipelineVariable, Verbose, WarningAction, and WarningVariable parameters to control how the cmdlet responds to errors, warnings, and output.
Conclusion
In this article, we discussed the syntax, parameters, inputs, outputs, examples, and tips for using the Get-PhysicalDisk cmdlet. Get-PhysicalDisk is a powerful cmdlet that can be used to get information about physical disks on a computer. With the right parameters and options, you can easily get the information you need.