Microsoft KB Archive/318766

= HOW TO: Use the Disk Summary Script Tool (Diskusage.pl) in Windows 2000 =

Article ID: 318766

Article Last Modified on 3/1/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition

-



This article was previously published under Q318766



IN THIS TASK
SUMMARY System Requirements for Diskusage.pl
 * Source Computer
 * Target Computer

Overview of Diskusage.pl Examples Troubleshooting REFERENCES



SUMMARY
This step-by-step article describes how to use the Disk Summary Script tool (Diskusage.pl) to display information about folders and files on both local and remote Windows 2000-based computers.

The Disk Summary Script tool is available in Windows 2000 Resource Kit Supplement 1. You can use this script tool to display the following information about folders or files that reside on NTFS file system volumes of local or remote computers:
 * Size of files
 * Compression state of files or folders
 * Type of object (whether the object is a file or folder)
 * Number of files in a folder
 * Owner of the file or the folder
 * Location of the file or the folder

back to the top

System Requirements for Diskusage.pl
Diskusage.pl runs on a source computer and acts on a target computer (which can be either the same computer or a different computer than the source computer). The following sections describe the system requirements to use this script tool to display information about files or folders on local or remote computers.

back to the top

Source Computer

 * The computer is running either Windows 2000 Professional or Windows 2000 Server.
 * ActiveState ActivePerl Build 521 is installed. This program is available in Windows 2000 Resource Kit.

You must also correctly configure the computer to run the Perl scripts that are included in Windows 2000 Resource Kit Supplement 1. The Resource Kit Windows Management Instrumentation (WMI) provider module (Wmi.pm) must be in the \Site\Lib\W2rk folder. The Resource Kit Setup program typically creates the W2rk folder, and then copies the Wmi.pm file to this folder.

If the W2rk folder is not automatically created during Setup, you can manually create this folder, and then configure the environment in which you want to run Diskusage.pl. For more information about how to manually configure this folder, see the &quot;Troubleshooting&quot; section later in this article.
 * You are logged on using a user account that is a member of the Administrators group of the target computer.

back to the top

Target Computer

 * The computer is running either Windows 2000 Professional or Windows 2000 Server.
 * The computer contains volumes that are formatted by using NTFS.

back to the top

Overview of Diskusage.pl
Diskusage.pl uses the following syntax:

diskusage.pl |  [  |  ...] [ -s  [ -u  -p  ]][ -recurse ][ -format table | list | csv ] [  ][ -unittype B | KB | MB ][ -filter [ -filter ...]]

The following list describes the parameters that you can use with Diskusage.pl:    |   [   |  ...]: Use this parameter to specify the folders or files whose information you want to display by using the following format: :\ \.

When you specify files, Diskusage.pl displays information about those files. When you specify a folder, Diskusage.pl displays information about the files in that folder.

You can use the wildcard character (*) in any position in the path. If you want to specify two or more folders or files, separate each item with a space. If the folder or file name contains a space, enclose the folder or file name and path with quotation marks (&quot;&quot;).

If the file or the folder is on a volume that is not mapped to the local computer, use the relative path (the path as seen from the remote computer). -s : Use this parameter to specify the name or Internet Protocol (IP) address of a remote computer. If you omit this parameter, the local computer is specified.  -u : Use this parameter to specify the user account with which you want to run Diskusage.pl. If you omit this parameter, Diskusage.pl uses the permissions of the currently logged-on user. If you use this parameter, you must also use the -p parameter to provide the user's password. -p : Use this parameter to specify the password of the user account that is specified by the -u parameter. The -p parameter is required when you use the -u parameter.

Both the -p parameter and the -u parameter are available only if you use the -s parameter.

NOTE: If the remote volume is mapped to a drive on the local computer, you can specify the mapped drive letter in the file path, for example, Z:\Winnt\Explorer.exe. You do not need to use the -s parameter to indicate another computer.

 -recurse: Use this parameter to add child objects of the specified folder to the output. If you omit this parameter, only files in the specified folders are included in the output. -format table|list| csv: Use this parameter to specify the output format. If you omit this parameter, Diskusage.pl uses the table format by default.</li> -v: Use this parameter to add the &quot;Owner&quot; entry to the output.</li> -unittype B|KB| MB: Use this parameter to specify the unit of disk space that is used to display the file size. If you omit this parameter, Diskusage.pl uses kilobytes (KB) by default.</li> -filter  [-filter ...]: Use this parameter to specify the criteria for folders and files that are included in the output. If you omit this parameter, all of the items that are specified in the   |   parameter are included in the output.

To establish more than one criteria, use a separate instance of -filter  for each criteria that you want to specify and separate each instance with a space. Diskusage.pl displays only those items that meet all of the criteria.

The following table lists the operators and values that are available for each field that is used with the -filter parameter and an example of each :</li></ul>

back to the top

Examples
 To display information about the Report1.doc file in the E:\Company Info\Reports folder of the local computer, type the following line at the command prompt, and then press ENTER:

diskusage.pl &quot;e:\company info\reports\report1.doc&quot; -v

</li> To display information about all files and subfolders in the C:\Winnt folder of the local computer, display the output in list format, and redirect the output to a file named &quot;Winnt_info.txt&quot; on drive E, type the following line at the command prompt, and then press ENTER:

diskusage.pl c:\winnt\*.* -format list > e:\winnt_info.txt -v

</li> To run Diskusage.pl by using the Administrator account to display information about the C:\Program Files and E:\Documents folders of a remote computer named &quot;Server5,&quot; type the following line at the command prompt, and then press ENTER:

diskusage.pl &quot;c:\program files&quot; e:\documents -s server5 -u server5\administrator -p

</li> To search for all uncompressed folders on volume M and on all child objects of volume M, type the following line at the command prompt, and then press ENTER:

NOTE: In this example, drive M on the local computer is mapped to the drive C of a remote computer.

diskusage.pl m: -recurse -filter &quot;compressed=no&quot; -filter &quot;type=directory&quot;

</li></ul>

back to the top

Troubleshooting
If you run Diskusage.pl, you receive the following error message:

ERROR: Wmi.pm is required to run the script.

Copy Wmi.pm from the Resource Kit directory to /Perl/site/lib/W2RK.

This behavior can occur if you did not configure the computer to run the Perl scripts that are included in Windows 2000 Resource Kit Supplement 1. To use Diskusage.pl, the W2rk folder must exist in the \site\lib folder and it must contain the Wmi.pm file.

To resolve this behavior, manually configure the environment in which you want to run Perl scripts:
 * 1) Create a folder named &quot;W2rk&quot; in the  \Site\Lib folder.

NOTE: The default  is  :\Perl, where   is the disk drive on which Windows is installed.
 * 1) Copy the Wmi.pm file from the folder in which Windows 2000 Resource Kit is installed (by default, this folder is Program Files\Resource Kit) to the W2rk folder that you created in step 1.

back to the top

<div class="references_section">