Microsoft KB Archive/318764

= HOW TO: Use the File Version Script Tool (Fileversion.pl) in Microsoft Windows 2000 =

Article ID: 318764

Article Last Modified on 11/1/2006

-

APPLIES TO


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

-



This article was previously published under Q318764





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

Overview of Fileversion.pl Examples Troubleshooting REFERENCES



SUMMARY
This step-by-step article describes how to use the File Version Script tool (Fileversion.pl) to display version information about files that reside on local and remote Microsoft Windows 2000-based computers.

The File Version Script tool is available in Microsoft Windows 2000 Resource Kit Supplement 1. Use this script tool to display the version number of files on NTFS volumes of local or remote computers. If the file is copyrighted, you can display the name of the company that holds the copyright. Executable (.exe) files and dynamic link library (.dll) files are examples of copyrighted files. Fileversion.pl also displays information about other file properties such as file size, location, and the date and time the file was last modified.

The version information that Fileversion.pl displays corresponds to the information that appears on the Version tab of the Properties dialog box of a copyrighted file. To view this information in Microsoft Windows Explorer, right-click a copyrighted file (for example, Winhlp32.exe in the Winnt folder), click Properties, and then click the Version tab.

back to the top

System Requirements for Fileversion.pl
Fileversion.pl runs on a source computer and acts on a target computer (which can be the same or different computer than the source computer). Before you can use this script tool to display version information of files on local or remote computers, the following requirements must be met.

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 the Windows 2000 Resource Kit.

The computer must also be correctly configured to run the Perl scripts that are included in the Windows 2000 Resource Kit Supplement 1. The Resource Kit WMI provider module, Wmi.pm, must be in the \Site\Lib\W2rk folder. The Resource Kit Setup program typically creates the W2rk folder and copies the Wmi.pm file to this folder.
 * You are logged on by using a user account that is a member of the administrators group on 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 with the NTFS file system.

back to the top

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

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

The parameters that you can use with Fileversion.pl are:    |   [   |  ...]: Use this parameter to specify the files whose version information you want to display by using the following format: :\ \.

You can use the wildcard character (*) in any position in the path. If you specify a folder, Fileversion.pl displays the version information of all files in the folder. 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;).

When the file or folder is on a volume that is not mapped to the local computer, use the relative path (the path as it is seen from the remote computer). -s : Use this parameter to specify the name or 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 to run Fileversion.pl. If you omit this parameter, Fileversion.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 and -u parameters are available only when 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, J:\Winnt\*.exe. You do not need to use the -s parameter to indicate another computer.

 -format table|list| csv: Use this parameter to specify the output format. If you omit this parameter, Fileversion.pl uses, by default, the table format.</li> -v: Use this parameter to add the Company Name entry to the display.</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, Fileversion.pl uses kilobytes (KB) by default.</li> -recurse: Use this parameter to add files in subfolders of the specified folders to the display. If you omit this parameter, only files that are in the specified folders are included in the display.</li> -filter  [-filter ...]: Use this parameter to specify the criteria for files that are included in the display. If you omit this parameter, all items that are specified in the   |   parameter are included in the display.

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. Fileversion.pl displays only those files and folders 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
<ol> To display the version and company name that holds the copyright to the Explorer.exe file in the C:\Winnt folder of the local computer, type the following line at the command prompt, and then press ENTER:

fileversion.pl c:\winnt\explorer.exe -v

</li> To display the versions and exact size in bytes of all of the .dll files that are in C:\Inetpub folder and its subfolders of the local computer, and then display the output in list format, type the following line at the command prompt, and then press ENTER:

fileversion.pl c:\inetpub\*.dll -format list -unittype b -recurse

</li> To display the versions and company names that hold the copyright to all .exe and .dll files in the C:\Winnt\System32 folder of the local computer in comma-delimited format, and then redirect the output to the E:\Ver\Sys32ver.csv file, type the following line at the command prompt, and then press ENTER:

fileversion.pl c:\winnt\system32\*.dll C:\winnt\system32\*.exe -format csv -v > e:\ver\sys32ver.csv

</li> To run Fileversion.pl by using the Administrator account to display the versions of all .exe files in the C:\Program Files\Microsoft Office folder and its subfolders of a remote computer that is named Server8, display the output in list format, and then redirect the output to a file that is named Version.txt in the root folder of drive E, type the following line at the command prompt, and then press ENTER:

fileversion.pl &quot;c:\Program Files\Microsoft Office\*.exe&quot; -s server8 -u server8\administrator -p  -format list > e:\version.txt -recurse

</li> To display the version information of all .exe files from the MyCompany Corporation that were modified before March 1, 2002 in the Z:\Program files\MyApp folder and all subfolders (with the exception the Temp folder), type the following line at the command prompt, and then press ENTER.

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

fileversion.pl &quot;z:\program files\myapp \*.exe&quot; -recurse -filter &quot;companyname=mycompany corp&quot; -filter &quot;path!z:\program files\myapp\temp&quot; -filter &quot;datetime<03/01/2002&quot;

</li></ol>

back to the top

Troubleshooting
When you try to run Fileversion.pl, you may 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 the computer is not correctly configured to run the Perl scripts that are included in the Windows 2000 Resource Kit Supplement 1. To use Fileversion.pl, the W2rk folder must exist in the \site\lib folder, and it must contain the Wmi.pmi file.

To resolve this behavior, manually configure the environment where you will run Perl scripts:
 * 1) Create a folder that is named W2rk in the  \Site\Lib folder.

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

back to the top

<div class="references_section">