JSI Tip 0662 - DISKUSE reports disk space used by each user.

Jerold Schulman

August 18, 1998

4 Min Read
ITPro Today logo in a gray background | ITPro Today

DISKUSE from Supplement Two of the NT 4.0 Server Resource KIT (see tip 107) is a command-line utility that scans directories on a hard disk and reports on space used by each user.

It can scan a single folder, a directory tree, or an entire drive and can extract information on one user or all users. DISKUSE reports can be displayed on-screen or output to a file, in table or text format. DISKUSE can also list all the files owned by a user or users, filtered in a variety of ways.

Usage: diskuse [switches]

If no path is specified, the current directory is assumed. The path can be a full path, relative path, or UNC.

If no switches are specified, subdirectories will not be scanned and the results will be displayed in the default format.

Switch

D e s c r i p t i o n

 /f: 

 Store the output in a file instead of displaying it on the screen. The file name can be a full name, relative name, or UNC. If Table Mode is specified, the file will be comma delimited. If you specify Table Mode and end the file with a .csv extension (Comma Separated Values), it can be directly loaded into Excel

 /e: 

 Store all error and warning messages in a file instead of displaying them on the screen. The file name can be a full name, relative name, or UNC

 /u: 

 Only scan for and report information about a specific user. The user name should be in the format DOMAINUSERNAME. If no domain is specified, it will use the first instance of the user it finds. 

 /s 

 Scan all subdirectories of the specified path. 

 /t 

Table Mode

 /w 

 By default all output will be in ANSI characters. Use this switch if you have Unicode file names on your server and wish to have them reported in Unicode format. Unicode will still be read, even if this switch is not present. This switch only effects the output. 

 /q 

 No information will be displayed on the screen. If this is used without the /F switch, the program is basically useless. If this is used without the /E switch, you will not get a report of any errors or warnings. 

 /? | h 

 Display a brief summary of usage and switches. 

 /r: 

 Specify a file to read restrictions from. If you want to limit the amount of space a user can use, create a file listing the user and their limit in bytes in the following format: DOMAINUSERNAME   . List one user per line. Lines starting with ; are comments. Anything after the is ignored. JSI/Jerry 100000000 will cause the report to be flagged if I use more than 100000000 bytes. 

 /o 

 Only report information on users that are over their limit. This switch only works if the /R switch is also used. 

 /v 

 List all of the files that each user owns. This switch can make the report very large. After listing a user, it will also list all of the files that user owns, the dates of the files, and the sizes of the files. The format of the output is as follows: SIZE : DATE : FILENAME. The only exception is if you are saving the output to disk (/F) and you are using Table Mode (/T), then the output is in the following format:SIZE,DATE,FILENAME. 

 /d:a|c|w 

 Specify the date to be display in a verbose output. This has no affect if /V is not specified. The choices are Last Accessed Date, Date Created, or Last Written To Date. 

 /n: 

 This will list only the largest files for each user. This has no affect if /V is not specified. 

 /x: 

 This will list only files that are bytes or larger. This has no affect if /V is not specified. 

Examples:

diskuse c: /s    Displays how much space each user has used on drive c.

diskuse c: /s /v /n:5 /x:2000000 /f:c_drive.txt    Stores each user in c_drive.txt with their 5 larges files > 2 Megs.

diskuse c: /s /v /o /r:restrict.txt    Displays all of the users that have exceeded there quota (in restrict.txt) on drive c.

diskuse c: /s /u:JSIJerry    Displays how much space user JSIJerry has used on drive c.

diskuse \servershare /s /t /f:usage.csv    Stores how much space each user has used on the share \servershare into the file usage.csv. This file is in table format and can be loaded directly into Excel.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like