Get drive information (gdr)
Syntax
Get-PSDrive { [[-name] string[]] | [-literalName] string[] }
[-Force] [-pSProvider string[]] [-scope string]
[-UseTransaction] [CommonParameters]
Key
-name string
Get only the specified drives.
Type the drive name or letter without a colon (:),
separate multiple names with commas.
-literalName string
The Drive name which will be used exactly as typed.
No characters are interpreted as wildcards. If the name includes escape
characters, enclose it in single quotation marks.
-pSProvider
Get only the drives supported by the specified PowerShell provider.
Type the name of a provider, such as:
FileSystem, Registry, or Certificate.
-scope
The scope within which to search for the drive.
Valid values are "Global", "Local", or "Script", or a number relative
to the current scope (0 through the number of scopes, where 0 is the
current scope and 1 is its parent).
"Local" is the default. For more information, see about_Scopes.
-UseTransaction
Include the command in the active transaction.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Standard Aliases for Get-PSDrive: gdr
Get-PSDrive gets the PowerShell drives in the current session. You can get a particular drive or all drives in the console.
Get-PSDrive gets the following drives:
- Windows logical drives on the computer, including drives mapped to network shares.
- Drives exposed by PowerShell providers (such as the Certificate:, Function:, and Alias: drives) and the HKLM: and HKCU: Registry drives.
- Drives created with New-PSDrive.
Get-PSDrive does not get Windows mapped drives that are added or created after the PowerShell console is opened.
Examples
Display information about all currently visible drives:
PS C:\> get-psdrive
Display the description of a PowerShell drive on your system:
PS C:\> (get-psdrive DriveName).description
Display information for drives with names that begin with HK (registry: HKLM, HKCU etc):
PS C:\> get-psdrive HK*
Display information for FileSystem drives:
PS C:\> get-psdrive -psprovider filesystem
"Heaven wheels above you, displaying to you her eternal glories, and still your eyes are on the ground" ~ Dante Alighieri
Related PowerShell Cmdlets:
New-PSDrive - Install a new drive on the machine.
Remove-PSDrive - Remove a provider/drive from its location.
get-wmiobject win32_logicaldisk.
get-wmiobject win32_networkconnection.
[System.IO.DriveInfo]::getdrives()
Equivalent bash command: ln - Make links between files.