Listing Web Virtual Directories Using Iisvdir.vbs (IIS 6.0)
You can use the command-line script iisvdir.vbs, which is stored in systemroot\System32, to list the virtual directory on local or remote computers running a member of the Windows Server 2003 family with IIS 6.0.
The /query operation only displays virtual directories at the root of the Web site, or path, and does not search recursively. Also, it does not display physical directories.
You must be a member of the Administrators group on the local computer to run scripts and executables. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run your script or executable as an administrator. At a command prompt, type runas /profile /User:MyComputer\Administratorcmd to open a command window with administrator rights and then type cscript.exeScriptName (include the script's full path and any parameters).
This topic includes the following information:
iisvdir /query WebSite[/VirtualPath][/s Computer [/u [Domain\]User/p Password]]
Required. Specifies the descriptive name, or the metabase path, of the Web site.
Specifies a path, if necessary, to the virtual directory within the Web site. This parameter is required when the virtual directory is not located at the root of the Web site.
Runs the script on the specified remote computer. Type the computer name or IP address without backslashes. The default is the local computer.
Runs the script with the permissions of the specified user account. This account must be a member of the Administrators group on the remote computer. By default, the script runs with the permissions of the current user of the local computer.
Specifies the password of the user account that is specified in the /u parameter.
The following example displays the virtual directories at the root of the "Finance" Web site on the local computer:
iisvdir /query Finance
The /s, /u, and /p parameters are unnecessary in this instance because the default computer is local and the user running the command must be logged on as an administrator.
In response, iisvdir displays the two virtual directories at the root of "Finance" Web site. These directories appear at the "Finance" root even though their physical locations are unrelated. In this example, "Alias" represents the names of the virtual directories, while "Physical Root" is their actual location.
This display does not include virtual directories that are subdirectories of the site. The procedure for finding subdirectories is demonstrated below in Example 2.
Alias Physical Root
The following example displays the virtual directories that are subdirectories of the "Insurance" virtual directory on the "Finance" Web site. The command specifies the "Insurance" directory by using its virtual path.
The example also uses the /s parameter to identify the remote computer, as well as the /u and /p parameters to run iisvdir.vbs with the permissions of the user's administrator account.
iisvdir /query Finance\Insurance
In response, iisvdir.vbs reveals the "Current" subdirectory of the "Insurance" virtual directory, and its physical location.
Alias Physical Root