Article ID: 188954
This article was previously published under Q188954
This article has been archived. It is offered "as is" and will no longer be updated.
NoticeWe strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly enhances Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:
CrtVDirD.exe is a self extracting executable that contains a Microsoft Visual C++ sample that demonstrates how to add and delete Virtual Directories and Applications in IIS 4.0 using the IIS Admin Base Object and the IWamAdmin Object. The sample was built with Visual C++ 5.0.
The following files are available for download from the Microsoft Download Center:
Download the Crtvdird.exe package now.
Collapse this imageExpand this image
(http://download.microsoft.com/download/iis40/Sample/1/NT4/EN-US/Crtvdird.exe)For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
(http://support.microsoft.com/kb/119591/ )How to obtain Microsoft support files from online services
Note This sample fails to build under Visual C++ 6.0. To solve this problem, change CrtVDir.cpp so that you include cguid.h before atlbase.h.
CrtVDir: uses the IIS Admin Base Object to add or remove Virtual Directories to a Web Server. It uses the IWamAdmin object to create or remove Applications.
Note You must create a virtual directory before you create an application.
To create a Virtual Directory (CD):
CrtVDir.exe CD <path> <name> [<permissions>] [<site>]To remove a Virtual Directory (RD):
CrtVDir.exe RD <name> [<site>]To create an Application (CA):
CrtVDir.exe CA <metabasepath> <INPROC|OOP>To remove an Application (RA):
CrtVDir.exe RA <metabasepath>Params:
Path - Physical path to which the Virtual Directory refers.
Name - Name for virtual directory.
Metabasepath - Metabasepath is the full metabase path to the relevant key. Note that if the path you enter does not begin with a "/" character, ISAPIReg prepends "/LM/" to the path.
Permissions - see later reference in article.
Site - Defaults to "1" if not supplied.
INPROC|OOP - Application runs in-process of out-of-process.
Permissions - The following values are for the common permission flags. These may be added together to form a combination of permissions for the virtual root:
1 = Read AccessSamples:
2 = Write Access
4 = Execute Access (including Script)
512 = Script Access
To obtain help on the command line parameters:
C:> CrtVDir.exeTo create NewVDir Virtual Directory pointing to D:\InetPub\wwwroot\NewVDir:
C:> CrtVDir.exe CD D:\InetPub\wwwroot\NewVDir NewVDirTo remove the same directory:
C:> CrtVDir.exe RD NewVDirTo create an application:
C:> CrtVDir.exe CA w3svc/1/root/NewVDir INPROCTo remove an application:
C:> CrtVDir.exe RA w3svc/1/root/NewVDirMetabase Issues:
The metabase is a secure object, and requires sufficient permissions to open and use. Any application that uses this code to access the metabase must run in a context with appropriate permissions.
The header file for IWamAdmin was not included in the Internet Information Server (IIS) 4.0 Software Development Kit (SDK). You can get the file from the following Web site:
Contact us for more help
Connect with Answer Desk for expert help.