Get Volume - PowerShell


Overview

The Get-Volume cmdlet retrieves information about the volumes on the local or remote computers. It provides details such as drive letter, volume name, file system, usage statistics, and health status. This command is useful for system administrators, storage managers, and anyone responsible for managing disk space and volume configurations.

Syntax

Get-Volume [-DriveLetter <char[]>] [-AccessPath <string[]>] [-FileSystemLabel <string[]>] [-FileSystemType <string[]>]
[-HealthStatus <HealthStatus[]>] [-Name <string[]>] [-Size <ulong[]>] [-Usage <ulong[]>] [-Credential <PSCredential>]
[-ComputerName <string>] [-Filter <string>] [-ErrorAction <ActionPreference>] [-ErrorVariable <string>]
[-OutFile <string>] [-OutVariable <string>] [-Verbose] [-Debug] [-WhatIf] [-Confirm]

Options/Flags

  • -DriveLetter: Filters volumes based on their drive letters.
  • -AccessPath: Filters volumes based on their access paths.
  • -FileSystemLabel: Filters volumes based on their file system labels.
  • -FileSystemType: Filters volumes based on their file system types.
  • -HealthStatus: Filters volumes based on their health status.
  • -Name: Filters volumes based on their names.
  • -Size: Filters volumes based on their sizes in bytes.
  • -Usage: Filters volumes based on their used space in bytes.
  • -Credential: Credentials to use when accessing remote computers.
  • -ComputerName: Specifies the computer name to retrieve volumes from.
  • -Filter: A filter expression to narrow down the search criteria.
  • -ErrorAction: Specifies how the cmdlet should handle errors.
  • -ErrorVariable: Stores errors that occur during the command execution.
  • -OutFile: Saves the output to a specified file.
  • -OutVariable: Stores the output in a specified variable.
  • -Verbose: Displays detailed information about the command execution.
  • -Debug: Displays additional debugging information.
  • -WhatIf: Simulates the command without making any changes.
  • -Confirm: Prompts for confirmation before executing the command.

Examples

Basic usage:

Get-Volume

Filter by drive letter:

Get-Volume -DriveLetter C

Filter by file system type:

Get-Volume -FileSystemType NTFS

Filter by health status:

Get-Volume -HealthStatus Healthy

Get detailed information about all volumes:

Get-Volume | Format-List *

Common Issues

  • Access denied: Ensure you have sufficient permissions to access the volumes on the specified computer.
  • Invalid filter syntax: Check the filter expression for any syntax errors.
  • No volumes found: The specified criteria may not match any existing volumes.

Integration

  • Get-Disk: Retrieves information about the physical disks associated with the volumes.
  • Set-Volume: Changes the properties of a specified volume.
  • Format-Volume: Formats a volume and assigns a file system to it.
  • Mount-Volume: Mounts a volume on a specified drive letter.