View Full Version : Deleting a Virtual directory thru Install Script

04-12-2002, 01:36 PM
can anyone give me an idea (sample code) about how to delete a Virtual directory in IIS, thru Install Script ?thanks

04-12-2002, 04:54 PM
I don't think IS provides a mechanism to do that. If this is true then the right way to delete/manage virtual directories is to have a custom dll and use the IISAdminBase object which interfaces to the metabase of IIS. Don't try changing the registry since it is only a cache for IIS and changes may or may not propogate to the metabase (inconsistent).

If you want the code for that then let me know. And if you find a way to do it through IS let me know.

Hope that helps.


04-15-2002, 01:10 AM
One way is to include the IIS script adsutil.vbs (included with IIS) in your installation (setup files), and call it with cmd.exe/cscript.exe using LaunchAppAndWait:

LaunchAppAndWait("cmd.exe", " /c cscript.exe //b + SUPPORTDIR ^ "adsutil.vbs" + " delete w3svc/1/NameOfVirtualDirectory", WAIT);

The above assumes the virtual directory is located in the first(1("Default Web Site")) web site in the IIS installation.

Another way, would be to visit http://www.installsite.org and check out the IISAdmin.dll (creates, deletes vdirs) or the _LaunchAppEx scripts to run the first solution mention above hidden.