SERVER-002 · Script
Check Disk Space Across Servers
Checks free space on every fixed drive across many servers at once and flags drives running low.
Version 1.0.0Language PowerShellUpdated November 2026Report only, changes nothing
What it does
Read-only. Connects to each server over WinRM (or DCOM if WinRM is off), reads every local fixed drive and saves a dated CSV in the Reports folder. A drive is Low when it is below either -MinFreePercent or -MinFreeGB. Servers that cannot be reached are listed as Unreachable. Pick servers by name with -ComputerName, or by OU with -SearchBase. With neither, it checks this computer.
Requirements
Windows PowerShell 5.1. Admin rights on the target servers. The ActiveDirectory module (RSAT) only when using -SearchBase.
How to run it
- Run as: a service account with the directory rights the script lists, or SYSTEM on a domain controller or the server being checked
- Run from: a domain-joined management server or admin workstation with the RSAT tools, as a scheduled task or from your management tool
- Script type: PowerShell 5.1, 64-bit
- User interaction: none; the script never prompts
- Timeout: 30 minutes for large directories or many servers
Settings
| Name | What it does | Options | Default |
|---|---|---|---|
| ComputerName | Server names to check. | (none) | |
| SearchBase | OU (distinguished name) whose enabled servers should be checked. Used when -ComputerName is empty. | ||
| MinFreePercent | Lowest acceptable free space, in percent. Default: 10. | 10 | |
| MinFreeGB | Lowest acceptable free space, in GB. Default: 10. | 10 | |
| ExcludeDrives | Drive letters to skip, for example D: for a drive that is meant to be full. | (none) | |
| AlertOn | Low (default) exits with code 1 when any drive is low or any server is unreachable. Never always exits 0. | Low, Never | Low |
| Server | Optional domain controller used for the -SearchBase lookup. |
Exit codes
- 0 = All drives above the thresholds
- 1 = Low drives or unreachable servers (with AlertOn Low)
- 2 = Script error (see log)
Testing steps
- Run it on one test OU, test account or test server and check the output and log.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- Roll out to a small group next, then everyone.
Rollback steps
Report only. Nothing is changed, so nothing needs to be rolled back.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |