This sample tool illustrates how to automate application creation for IIS using WSH.
The first section of the script simply parses the various switches and arguments, but the real work begins with the call to the GetObject method. GetObject takes as an argument a valid ADsPath, such as IIS://LocalHost/W3SVC/3/TestVirDir, and returns a reference to the ADSI wrapper object for the specified virtual Web directory or a Web directory. The AppCreate method is then invoked to create an application that has as its root the specified directory.
The script is available in the IIS samples directory, at ...\admin\appcreate.vbs.