tags:

views:

127

answers:

2

I'm running Windows 2003 R2 and IIS 6.0 with web applications written in ASP.NET.

I am looking for good samples of scripts (.bat, .cmd, .VBS, or powershell) to allow me to:

For websites:

  • Create website
  • Verify if website exists
  • Delete website

For virtual directories:

  • Create virtual directory
  • Verify if virtual directory exists
  • Delete virtual directory

For application pools:

  • Create application pool
  • Verify if application pool exists
  • Delete application pool
  • Assigning website to application pool

thanks..

A: 

Most of what you need can be found in the system32 directory. Look for the files:

iis*.vbs

for start run:

cscript c:\WINDOWS\system32\iisweb.vbs /?

To create application pool, look at David Wang post.

Igal Serban
+1  A: 

I answered a similar question the other day:

Automated creation of IIS websites (Stack Overflow)

You can use the System.DirectoryServices namespace directly from PowerShell as well as C#.

Kev