Category filter

PowerShell script to get volume information from Windows devices

Managing storage volume on Windows devices in an organization is crucial for resource utilization. Fetching information about storage volumes like health status, size used, etc., facilitates efficient resource monitoring with the help of a detailed overview of the device’s storage. IT administrators can use the PowerShell script to get volume information on Windows devices. With Hexnode’s Execute Custom Script remote action, IT admins can execute the PowerShell script to get the information about volume on Windows devices.

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

PowerShell script fetch information of all volumes

The above PowerShell script uses the Get-Volume command to fetch the information on all the volumes present on the device.

DriveLetter: The letter assigned to the volume used as a reference for accessing the volume within the Windows operating system.

FriendlyName: Friendly name of the volume if there is any. If there is no name set it will display the output as empty.

FileSystemType: The type of file system used on the volume determines how data is stored, organized, and accessed. (e.g., NTFS-New Technology File System, FAT32-File Allocation Table 32, and exFAT-Extended File Allocation Table).

DriveType: This indicates the type of drive the volume is associated with. For example, “Fixed” drives refer to internal hard disk drives, while “Removable” drives include external USB drives.

HealthStatus: Provides information about the overall health condition of the volume, indicating whether any issues or errors have been detected.

OperationalStatus: The operational status of the volume, such as whether it’s online or offline.

Size: Describes the total volume capacity of the device.

SizeUsed: Amount of the size used in the volume.

SizeRemaining: Amount of free space in the volume.

Execute from the Hexnode console this PowerShell script to get volume information of all the volumes on Windows devices

PowerShell script get information of specific volume on Windows devices

The above script defines a parameter DriveLetter, allowing administrators to specify a drive letter for which they want to retrieve volume information. By default, it fetches information for the ‘C’ drive.

Data regarding a specific drive letter is retrieved after executing the PowerShell script to get volume information

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository