Create/Delete virtual directory in Windows XP Pro IIS by command line

F

foldface

Hi
I want to create/delete a virtual directory in Windows XP via a batch file.
I gather that this is a cut down version of IIS compared to Windows
Server 2003. The scripts that come with Server 2003 don't come with XP,
although there are some scripts in c:\Inetpub\AdminScripts

29/09/2003 10:24 <DIR> ..
21/07/2001 13:21 93,538 adsutil.vbs
21/07/2001 13:21 4,490 chaccess.vbs
21/07/2001 13:21 2,623 contsrv.vbs
21/07/2001 13:21 2,596 contweb.vbs
21/07/2001 13:21 5,017 dispnode.vbs
21/07/2001 13:21 2,550 disptree.vbs
21/07/2001 13:21 6,258 findweb.vbs
21/07/2001 13:21 7,186 mkwebdir.vbs
21/07/2001 13:21 2,615 pausesrv.vbs
21/07/2001 13:21 2,588 pauseweb.vbs
21/07/2001 13:21 2,617 startsrv.vbs
21/07/2001 13:21 2,590 startweb.vbs
21/07/2001 13:21 2,608 stopsrv.vbs
21/07/2001 13:21 2,581 stopweb.vbs
21/07/2001 13:21 6,064 synciwam.vbs

I can see that mkwebdir will create a virtual directory, how can I delete one?
If someone has a script I can use can they post it.

Ta
F
 
F

foldface

Hi
I want to create/delete a virtual directory in Windows XP via a batch file.
I gather that this is a cut down version of IIS compared to Windows
Server 2003. The scripts that come with Server 2003 don't come with XP,
although there are some scripts in c:\Inetpub\AdminScripts

29/09/2003 10:24 <DIR> ..
21/07/2001 13:21 93,538 adsutil.vbs
21/07/2001 13:21 4,490 chaccess.vbs
21/07/2001 13:21 2,623 contsrv.vbs
21/07/2001 13:21 2,596 contweb.vbs
21/07/2001 13:21 5,017 dispnode.vbs
21/07/2001 13:21 2,550 disptree.vbs
21/07/2001 13:21 6,258 findweb.vbs
21/07/2001 13:21 7,186 mkwebdir.vbs
21/07/2001 13:21 2,615 pausesrv.vbs
21/07/2001 13:21 2,588 pauseweb.vbs
21/07/2001 13:21 2,617 startsrv.vbs
21/07/2001 13:21 2,590 startweb.vbs
21/07/2001 13:21 2,608 stopsrv.vbs
21/07/2001 13:21 2,581 stopweb.vbs
21/07/2001 13:21 6,064 synciwam.vbs

I can see that mkwebdir will create a virtual directory, how can I delete one?
If someone has a script I can use can they post it.

Ta
F

// create_vdir.js
if (WScript.Arguments.length < 2)
{
WScript.Echo("Usage: " + WScript.ScriptName + "
virtual_directory_name physical_path");
WScript.Quit();
}
var vdirname = WScript.Arguments(0);
var physicalpath = WScript.Arguments(1);
fso = new ActiveXObject("Scripting.FileSystemObject");
if (!fso.FolderExists(physicalpath))
{
WScript.Echo("Physical path \"" + physicalpath + "\" doesn't
exist. \nUse an existing path.");
WScript.Quit();
}
WScript.Echo ("Creating virtual directory:\t" + vdirname + "\tPath:\t"
+ physicalpath);

var VDirRoot = GetObject("IIS://localhost/W3SVC/1/ROOT");
var NewVDir = VDirRoot.Create("IIsWebVirtualDir", vdirname);

NewVDir.Path = physicalpath
NewVDir.AppCreate2(2)

NewVDir.SetInfo();
 
Joined
Mar 13, 2010
Messages
1
Reaction score
0
Doesn't work for me:

---------------------------
Windows Script Host
---------------------------
Script: D:\inetpub\wwwroot\CMV1CODEBASE\create_vdir.js
Line: 17
Char: 1
Error: Invalid syntax
Code: 800401E4
Source: (null)

---------------------------
OK
---------------------------

Thanks for any help.
 
Top