用VBS修改IIS Metabase 的代码
程序员文章站
2022-06-16 19:57:54
////////////////////////// 作者:jaron, 江都资讯网 邮件:jaron@jdinfo.net 网址:http://ww...
//////////////////////////
作者:jaron, 江都资讯网
邮件:jaron@jdinfo.net
网址:http://www.jiangdu.net
如果您要转载该文章,请注明出处。
//////////////////////////
本文解释如何用 microsoft 自带的adsutil.vbs 来修改 iis metabase 的设置方法,这里是通过调用 bat批处理的方法来实现的,灵活运用一下,可以用于 installshield 和其他地方。
测试环境:windows 2000 server (装有iis服务)
所需文件::
1. cscript.exe
2. adsutil.vbs (该文件在 c:\inetpub\adminscripts 下)
已经在目标目录下创建了一个iis的子目录
在installshield中的应用:
#########
launchappandwait( supportdir ^ "vdir.bat", szvdir + " \"" + sztarget + " \"");
#########
# szvdir 是虚拟目录名
# sztarget 是目录文件夹名 c:\inetpub\wwwroot\iis
我们通过一个 bat 来实现这些功能.
vdir.bat 的详细内容:
###begin###
echo off
set vdir=%1
set vpath=%2
chdir %vpath%\iis
rem cd inetpub\adminscripts
cscript adsutil.vbs delete w3svc/1/root/%vdir% # 删除已经存在的虚拟目录
cscript adsutil.vbs create_vdir w3svc/1/root/%vdir% #创建虚拟目录
cscript adsutil.vbs set w3svc/1/root/%vdir%/path %vpath% # 主目录路径
cscript adsutil.vbs set w3svc/1/root/%vdir%/defaultdoc "login.asp" # 默认文档
###end###
adsutil.vbs 还可以实现很多功能,大家自已去探索吧,以下是关于 adsutil.vbs 的帮助(英文)
================================================================================
usage:
adsutil.vbs cmd [param param]
note: adsutil only supports the "no switch" option of mdutil
description:
iis k2 administration utility that enables the manipulation with adsi parameters
standard mdutil commands:
adsutil.vbs get path - display chosen parameter
adsutil.vbs set path value ... - assign the new value
adsutil.vbs enum path ["/p" | "/a"] - enumerate all parameters for given path
adsutil.vbs delete path - delete given path or parameter
adsutil.vbs create path [keytype] - create given path and assigns it the given keytype
adsutil.vbs appcreateinproc w3svc/1/root - create an in-proc application
adsutil.vbs appcreateoutproc w3svc/1/root - create an out-proc application
adsutil.vbs appcreatepoolproc w3svc/1/root- create a pooled-proc application
adsutil.vbs appdelete w3svc/1/root - delete the application if there is one
adsutil.vbs appunload w3svc/1/root - unload an application from w3svc runtime lookup table.
adsutil.vbs appdisable w3svc/1/root - disable an application - appropriate for porting to another machine.
adsutil.vbs appenable w3svc/1/root - enable an application - appropriate for importing from another machine.
adsutil.vbs appgetstatus w3svc/1/root - get status of the application
new adsi options:
/p - valid for enum only. enumerates the paths only (no data)
/a - valid for enum only. enumerates all data that can be set on the node
keytype - valide for create only. assigns the valid keytype to the path
extended adsutil commands:
adsutil.vbs find path - find the paths where a given parameter is set
adsutil.vbs create_vdir path - create given path as a virtual directory
adsutil.vbs create_vserv path - create given path as a virtual server
adsutil.vbs start_server path - starts the given web site
adsutil.vbs stop_server path - stops the given web site
adsutil.vbs pause_server path - pauses the given web site
adsutil.vbs continue_server path - continues the given web site
samples:
adsutil.vbs get w3svc/1/serverbindings
adsutil.vbs set w3svc/1/serverbindings ":81:"
adsutil.vbs create w3svc/1/root/myvdir "iiswebvirtualdir"
adsutil.vbs start_server w3svc/1
adsutil.vbs enum /p w3svc
extended adsutil commands:
adsutil.vbs find path - find the paths where a given parameter is set
adsutil.vbs create_vdir path - create given path as a virtual directory
adsutil.vbs create_vserv path - create given path as a virtual server
adsutil.vbs start_server path - starts the given web site
adsutil.vbs stop_server path - stops the given web site
adsutil.vbs pause_server path - pauses the given web site
adsutil.vbs continue_server path - continues the given web site
samples:
adsutil.vbs get w3svc/1/serverbindings
adsutil.vbs set w3svc/1/serverbindings ":81:"
adsutil.vbs create w3svc/1/root/myvdir "iiswebvirtualdir"
adsutil.vbs start_server w3svc/1
adsutil.vbs enum /p w3svc
作者:jaron, 江都资讯网
邮件:jaron@jdinfo.net
网址:http://www.jiangdu.net
如果您要转载该文章,请注明出处。
//////////////////////////
本文解释如何用 microsoft 自带的adsutil.vbs 来修改 iis metabase 的设置方法,这里是通过调用 bat批处理的方法来实现的,灵活运用一下,可以用于 installshield 和其他地方。
测试环境:windows 2000 server (装有iis服务)
所需文件::
1. cscript.exe
2. adsutil.vbs (该文件在 c:\inetpub\adminscripts 下)
已经在目标目录下创建了一个iis的子目录
在installshield中的应用:
#########
launchappandwait( supportdir ^ "vdir.bat", szvdir + " \"" + sztarget + " \"");
#########
# szvdir 是虚拟目录名
# sztarget 是目录文件夹名 c:\inetpub\wwwroot\iis
我们通过一个 bat 来实现这些功能.
vdir.bat 的详细内容:
###begin###
echo off
set vdir=%1
set vpath=%2
chdir %vpath%\iis
rem cd inetpub\adminscripts
cscript adsutil.vbs delete w3svc/1/root/%vdir% # 删除已经存在的虚拟目录
cscript adsutil.vbs create_vdir w3svc/1/root/%vdir% #创建虚拟目录
cscript adsutil.vbs set w3svc/1/root/%vdir%/path %vpath% # 主目录路径
cscript adsutil.vbs set w3svc/1/root/%vdir%/defaultdoc "login.asp" # 默认文档
###end###
adsutil.vbs 还可以实现很多功能,大家自已去探索吧,以下是关于 adsutil.vbs 的帮助(英文)
================================================================================
usage:
adsutil.vbs cmd [param param]
note: adsutil only supports the "no switch" option of mdutil
description:
iis k2 administration utility that enables the manipulation with adsi parameters
standard mdutil commands:
adsutil.vbs get path - display chosen parameter
adsutil.vbs set path value ... - assign the new value
adsutil.vbs enum path ["/p" | "/a"] - enumerate all parameters for given path
adsutil.vbs delete path - delete given path or parameter
adsutil.vbs create path [keytype] - create given path and assigns it the given keytype
adsutil.vbs appcreateinproc w3svc/1/root - create an in-proc application
adsutil.vbs appcreateoutproc w3svc/1/root - create an out-proc application
adsutil.vbs appcreatepoolproc w3svc/1/root- create a pooled-proc application
adsutil.vbs appdelete w3svc/1/root - delete the application if there is one
adsutil.vbs appunload w3svc/1/root - unload an application from w3svc runtime lookup table.
adsutil.vbs appdisable w3svc/1/root - disable an application - appropriate for porting to another machine.
adsutil.vbs appenable w3svc/1/root - enable an application - appropriate for importing from another machine.
adsutil.vbs appgetstatus w3svc/1/root - get status of the application
new adsi options:
/p - valid for enum only. enumerates the paths only (no data)
/a - valid for enum only. enumerates all data that can be set on the node
keytype - valide for create only. assigns the valid keytype to the path
extended adsutil commands:
adsutil.vbs find path - find the paths where a given parameter is set
adsutil.vbs create_vdir path - create given path as a virtual directory
adsutil.vbs create_vserv path - create given path as a virtual server
adsutil.vbs start_server path - starts the given web site
adsutil.vbs stop_server path - stops the given web site
adsutil.vbs pause_server path - pauses the given web site
adsutil.vbs continue_server path - continues the given web site
samples:
adsutil.vbs get w3svc/1/serverbindings
adsutil.vbs set w3svc/1/serverbindings ":81:"
adsutil.vbs create w3svc/1/root/myvdir "iiswebvirtualdir"
adsutil.vbs start_server w3svc/1
adsutil.vbs enum /p w3svc
extended adsutil commands:
adsutil.vbs find path - find the paths where a given parameter is set
adsutil.vbs create_vdir path - create given path as a virtual directory
adsutil.vbs create_vserv path - create given path as a virtual server
adsutil.vbs start_server path - starts the given web site
adsutil.vbs stop_server path - stops the given web site
adsutil.vbs pause_server path - pauses the given web site
adsutil.vbs continue_server path - continues the given web site
samples:
adsutil.vbs get w3svc/1/serverbindings
adsutil.vbs set w3svc/1/serverbindings ":81:"
adsutil.vbs create w3svc/1/root/myvdir "iiswebvirtualdir"
adsutil.vbs start_server w3svc/1
adsutil.vbs enum /p w3svc