Friday, November 21, 2008

Script to Audit Disk Usage

This is a very basic script, which connects each server in a given list, then collects and reports the disk usage information for the fixed disks on each system. Script displays the drive letter, disk size, used and available disk space information on the screen and writes to a tab separated text file. I selected the tab separated file format for portability: You can easily copy and paste the contents to an Excel sheet. Script uses WMI to connect to the servers and collect the data, so please be aware that you will either need to shutdown Windows Firewall or add a "file and printer sharing exception" on the target systems.

I have tested the script on Windows XP, Windows Vista, Windows 2003 and Windows 2008. I hope the script will be very handy for easily creating disk usage reports on multiple servers and/or workstations. This script uses a very similar logic to my service account audit script. Only difference is in the WMI query section.

Usage:

cscript q_FixedDrv.vbs filename

For example:

cscript q_FixedDrv.vbs serverlist.txt

To download the script and sample serverlist.txt file, click on "I agree", you will be forwarded to the download site. Modify the serverlist.txt file to fit your test environment, then start the script. If the result you get is satisfactory, then create another list file which includes your production servers/workstations. If you have any feedback regarding this script, feel free to contact me using the comment link. I really want to know if you like it or hate it.

2 comments:

Anonymous said...

Script is very nice. I have been looking for it for a while.

Two options would be nice:
- output to csv file.
- option to disable msgbox.

Thnx.

Anonymous said...

Excellent and very useful. Thanks a lot.