-
Notifications
You must be signed in to change notification settings - Fork 5
Get Disk
Module: base-module-example
Friendly Name: Get disk information
Description: Retrieves information like index, model, size and operational status.
Uses login object: Yes
Returns: PSObject
Format: -ComputerName {{ComputerName}}
Type: String
Required: true
Format: -Number {{Number}}
Type: Number
Required: false
Invoke-Command {{ComputerName}} -Credential $Global:CredentialObject -ScriptBlock { Get-Disk {{Number}} | Select-Object Number, FriendlyName, OperationalStatus, @{n='Size';e={[math]::Round($_.Size / 1GB)}} | ConvertTo-Json -Compress }
Gets one or more disks visible to the operating system.
Get-Disk [[-Number] <UInt32[]>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-UniqueId <String[]>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-FriendlyName <String[]>] [-SerialNumber <String[]>] [-CimSession <CimSession[]>]
[-ThrottleLimit <Int32>] [-AsJob] [<CommonParameters>]
Get-Disk [-Path <String[]>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [<CommonParameters>]
Get-Disk [-Partition <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-VirtualDisk <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-iSCSISession <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-iSCSIConnection <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-StorageSubSystem <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-StorageNode <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
Get-Disk [-StorageJob <CimInstance>] [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob]
[<CommonParameters>]
The Get-Disk cmdlet gets one or more Disk objects visible to the operating system, or optionally a filtered list.
PS C:\>Get-Disk
This example gets all disks visible to the operating system.
PS C:\>Get-Disk -Number 6
This example gets disk 6.
PS C:\>Get-Disk | Where-Object -FilterScript {$_.Bustype -Eq "USB"}
This example gets all disks attached via the USB bus by piping the output of Get-Disk to the Where-Object cmdlet, and filtering by the USB value of the Bustype property.
PS C:\>Get-Disk | Where-Object -FilterScript {$_.BusType -Eq "iSCSI"} |
Get-IscsiSession | Format-Table
This example gets all disks attached via the iSCSI bus by piping the output of Get-Disk to the Where-Object cmdlet, and filtering by the iSCSI value of the Bustype property. It then passes the Disk objects in the pipeline to the Get-IscisSession cmdlet, which gets the associated iSCSI sessions, and then pipes the output to the Format-Table cmdlet for simplified display.
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.
Type: CimSession[]
Parameter Sets: (All)
Aliases: Session
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Gets the disk with the specified friendly name. Enter a friendly name, or use wildcard characters to enter a name pattern.
Type: String[]
Parameter Sets: ByName
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the disk number for which to get the associated Disk object.
Type: UInt32[]
Parameter Sets: ByNumber
Aliases: DeviceId
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Accepts a Partition object as input. The Partition CIM object is exposed by the Get-Partition cmdlet.
Type: CimInstance
Parameter Sets: ByPartition
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Contains valid path information.
Type: String[]
Parameter Sets: ByPath
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
Specifies an array of serial numbers associated with disks that this cmdlet gets.
Type: String[]
Parameter Sets: ByName
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies a storage job object that is associated with disks that this cmdlet gets. To obtain a storage job, use the Get-StorageJob cmdlet.
Type: CimInstance
Parameter Sets: ByStorageJob
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
@{Text=}
Type: CimInstance
Parameter Sets: ByStorageNode
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the storage subsystem from which this cmdlet gets disks. To obtain a StorageSubsystem object, use the Get-StorageSubSystem cmdlet.
Type: CimInstance
Parameter Sets: ByStorageSubSystem
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Gets only the disks with the specified IDs. Type one or more IDs (separated by commas).
Type: String[]
Parameter Sets: ByUniqueId
Aliases: Id
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Accepts a VirtualDisk object as input. The Virtual Disk CIM object is exposed by the Get-VirtualDisk cmdlet.
Type: CimInstance
Parameter Sets: ByVirtualDisk
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Accepts an iSCSIConnection object as input. The iSCSI Connection CIM object is exposed by the Get-IscsiConnection cmdlet.
Type: CimInstance
Parameter Sets: ByiSCSIConnection
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Accepts an iSCSISession object as input. The iSCSI Session CIM object is exposed by the Get-IscsiSession cmdlet.
Type: CimInstance
Parameter Sets: ByiSCSISession
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
{{ Fill AsJob Description }}
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
You can pipe an iSCSIConnection object to the iSCSIConnection parameter.
You can pipe an iSCSISession object to the iSCSISession parameter.
You can pipe a Partition object to the Partition parameter.
You can pipe a VirtualDisk object to the VirtualDisk parameter.
This cmdlet outputs one or more objects representing disks.
The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign (#) provides the namespace and class name for the underlying WMI object.
Some objects such as disks might include trailing spaces in their friendly names. If you suspect that an object name could have trailing spaces, you can use a wildcard at the end of the name, for example Disk*, or use the Match parameter to instruct Windows PowerShell to include all strings that include the specified characters, instead of only strings that include only the specified characters.
- How to Use
- Login Page
- Scripts Page
- Settings Page
- About Page
- Workflows
- How to Install CredentialManager Module
- How to Install PowerShell Core
- Setting up Development Environment
- Contributing to Project
- Components
- Login Page Breakdown
- Scripts Page Breakdown
- Settings Page Breakdown
- About Page Breakdown
- Command Execution
- Get SavedCredentials
- Scripts definitions update workflow