Use VBS to modify IIS Metabase code

Source: Internet
Author: User
Tags metabase

//////////////////////////
Author: Jaron, jiangdu Zixun
Mail: jaron@jdinfo.net
Web: http://www.jiangdu.net
If you want to reprint this article, please indicate the source.
//////////////////////////
This article explains how to use Microsoft's adsutil. vbs is used to modify the IIS Metabase setting method. It is implemented by calling the BAT batch processing method. It can be used flexibly for InstallShield and other places.

Test environment: Windows 2000 Server (with IIS Service)
Required files ::
1. cscript.exe
2. adsutil. vbs (the file is under C: \ Inetpub \ AdminScripts)
A subdirectory of IIS has been created in the target directory.

Applications in InstallShield:
#########
LaunchAppAndWait (suppdir dir ^ "vdir. bat", szVdir + "\" "+ szTarget + "\"");
#########
# SzVdir is the virtual directory name
# SzTarget is the directory folder name C: \ inetpub \ wwwroot \ iis
We use a bat to implement these functions.

Vdir. bat details:
### BEGIN ###
Echo off
Set vdir = % 1
Set vpath = % 2
Chdir % vpath % \ iis
Rem cd Inetpub \ Adminscripts
Cscript adsutil. vbs delete w3svc/1/root/% vdir % # delete an existing virtual directory
Cscript adsutil. vbs create_vdir w3svc/1/root/% vdir % # create a virtual directory
Cscript adsutil. vbs set w3svc/1/root/% vdir %/path % vpath % # main directory path
Cscript adsutil. vbs set w3svc/1/root/% vdir %/DefaultDoc "login. asp" # default document
### END ###

Adsutil. vbs can also implement many functions. Let's explore it by yourself. Here is the help for adsutil. vbs)
========================================================== ==========================================================
Usage:
ADSUTIL. vbs cmd [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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.