This PowerShell script (Watch-TopWriteIO.ps1) helps administrators monitor the top processes writing to disk in real time. It displays output in the console and can optionally log results to a CSV file for later analysis.

Requirements

  • Windows Server 2016 or newer (also works on Windows 10/11)
  • PowerShell 5.1+
  • Administrator privileges (for performance counters)

What the Script Does

  • Collects live disk write I/O from running processes
  • Sorts by bytes written per second
  • Displays the top X processes
  • Optionally logs data to CSV with timestamp
  • Supports refresh interval, screen clearing, and logging options

Parameters

ParameterDescription
-RefreshSecondsRefresh rate in seconds (default: 10)
-ClearClears the console between each output
-LogEnables CSV logging (appends to file)
-FilePathCSV log file path (default: working directory)
-TopNumber of top processes to display and log (default: 10)

Example Usage

.\Watch-TopWriteIO.ps1
.\Watch-TopWriteIO.ps1 -Top 20 -Clear
.\Watch-TopWriteIO.ps1 -Log -FilePath "C:\Logs\IO-Monitor.csv"

CSV Logging Behavior

  • If the file doesn't exist, it creates one with headers.
  • If the file exists, it appends new rows.
  • Each row includes Process, WriteIO_BytesPerSec, and Timestamp.
  • Timestamp format: yyyy/MM/dd HH:mm:ss

Notes

  • Processes may appear with suffixes (e.g. chrome#1) due to multiple instances.
  • Script uses Get-Counter, which is more consistent than Get-Process on Server versions.
  • Ideal for diagnosing FSLogix or RDS disk I/O issues.

Troubleshooting

IssueSolution
"Access Denied" or no outputRun PowerShell as Administrator
No visible outputVerify Performance Logs and Alerts service is running
Missing expected processesTry increasing -Top or check if process is actively writing