 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get the disk performance using PowerShell?
To get the disk performance using PowerShell, we need to use the Performance counter of the disk. There are performance counters available for the Physical disk or the logical disk. To check what the disks related counter sets are available we can use the below command,
Example
PS C:\> Get-Counter -ListSet "*disk*" | Select CounterSetName
Output
CounterSetName -------------- FileSystem Disk Activity Storage Spaces Virtual Disk LogicalDisk PhysicalDisk
We will use a Logical disk to get more information about it. We will retrieve its counter first.
Example
Get-Counter -ListSet LogicalDisk | Select -ExpandProperty Counter
Output

We need to retrieve the Disk read time counter,
Example
Get-Counter -Counter '\LogicalDisk(*)\% Disk Read Time'
Output

The below command will retrieve the 2 sample counts with 2 sample intervals.
Example
Get-Counter -Counter '\LogicalDisk(*)\% Disk Read Time' -MaxSamples 2 -SampleInterval 2
To get the continuous intervals, use the below command.
Example
Get-Counter -Counter '\LogicalDisk(*)\% Disk Read Time' -Continuous
Advertisements
 