Modifying the code for IIS Metabase with a VBS _vbs

Source: Internet
Author: User
Tags metabase
//////////////////////////
Author: Jaron, Jiangdu Information Network
Mail: jaron@jdinfo.net
URL: http://www.jiangdu.net
If you want to reprint the article, please indicate the source.
//////////////////////////
This article explains how to modify the Setup method of the IIS Metabase with Microsoft's adsutil.vbs, which is accomplished by invoking the bat batch method, which can be used flexibly for InstallShield and other places.

Test environment: Windows Server (with IIS services installed)
Required Documents::
1. cscript.exe
2. Adsutil.vbs (the document is under C:\Inetpub\AdminScripts)
A subdirectory of IIS has been created in the target directory

Applications in InstallShield:
#########
Launchappandwait (supportdir ^ "Vdir.bat", Szvdir + "" "+ Sztarget +" ");
#########
# Szvdir is a virtual directory name
# Sztarget is the directory folder name C:\inetpub\wwwroot\iis
We use a bat to implement these functions.

Details of 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% # Delete a virtual directory that already exists
cscript adsutil.vbs Create_vdir w3svc/1/root/%vdir% #创建虚拟目录
cscript adsutil.vbs set w3svc/1/root/%vdir%/path%vpath% # home directory path
cscript adsutil.vbs set W3svc/1/root/%vdir%/defaultdoc "Login.asp" # Default Document
# # #END ###

Adsutil.vbs can also achieve a lot of functions, we have to explore it, the following is about the help of Adsutil.vbs (English)
================================================================================
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 a application from W3SVC runtime lookup table.
Adsutil.vbs appdisable w3svc/1/root-disable a application-appropriate for porting to another machine.
Adsutil.vbs appenable w3svc/1/root-enable a 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, CAN is 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.