Hello,
Thank you for your question and for reaching out with your question today.
Yes, you can get disk latency or disk usage information using PowerShell. Here are some PowerShell commands to retrieve this information:
- To get disk usage information:
Get-WmiObject Win32_LogicalDisk | Select-Object DeviceID, MediaType, Size, FreeSpace, FileSystem, VolumeName
This command will display information about all logical disks on your system, including their Device ID, size, free space, file system, and volume name.
- To get disk latency information, you can use the Performance Counter cmdlets. For example, to retrieve the average disk read and write latency in milliseconds, you can use the following commands:
$diskReadLatency = Get-Counter -Counter "\PhysicalDisk(_Total)\Avg. Disk Read Latency"
$diskWriteLatency = Get-Counter -Counter "\PhysicalDisk(_Total)\Avg. Disk Write Latency"
$diskReadLatency.CounterSamples | Select-Object -Property InstanceName, CookedValue
$diskWriteLatency.CounterSamples | Select-Object -Property InstanceName, CookedValue
These commands will display the average disk read and write latency in milliseconds for all physical disks on your system.
Please note that to run these PowerShell commands, you need to have appropriate permissions on your system. Additionally, depending on the PowerShell version and the Windows version you are using, the commands might vary slightly.
I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.
If the reply was helpful, please don’t forget to upvote or accept as answer.
Best regards.