Wednesday, July 25, 2012

IIS Web Application via Command Lines

Before a month ago I faced many problems in IIS web application directory creation via command line. I read many articles on internet and finally got the solution of it. I want to share the solution with you which helped me a lot.


In IIS 5.0C:\Inetpub\AdminScripts\mkwebdir.vbs -c Localhost -w "Default Web Site" –v "ParentWebApplication/ChildWebApplicationName","Physical Path of the Web Application Directory"

cscript C:\Inetpub\AdminScripts\adsutil.vbs appcreateinproc w3svc/1/root/ParentWebApplication/ChildWebApplicationName

In IIS 6.0
cscript %SystemRoot%\system32\iisvdir.vbs /create "Default Web Site/ParentWebApplication" "ChildWebApplicationName" "Physical Path of the Web Application Directory"

In IIS 7.0
appcmd.exe add app /site.name:"default web site" /path:/ParentWebApplication/ChildWebApplicationName /physicalpath:"Physical Path of the Web Application Directory"

You can use all the commands in a batch file too to run the task automatically via batch file.


Regards,

Pradeep Kumawat
Network & System Engineer