Disk Latency

Handian Sudianto 6,096 Reputation points
2023-07-31T01:31:54.8766667+00:00

Hello,

Can we get disk latency or disk using script or power shell?

Windows for business Windows Server User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,746 Reputation points
    2023-07-31T10:29:05.33+00:00

    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:

    1. 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.

    1. 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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.