Attention: We are retiring the IIS.NET Community Blogs. Learn more >

How To: Using IIS 6.0 Command Line Utilities - Part 1

Q.) I would like to control a few operations of my IIS management through batch files. What I am looking at are simple tasks such as Restart IIS on development servers, viewing configuration and stuff like that. How can I possibly achieve that?

I am pretty new at IIS, so please excuse me if this is a simple question.

Ans.) I will be giving you a know how of various command line utilities that you can use if you are running Windows Server 2003 with IIS 6.0. But, from there on it depends on how you make use of this utilities to achieve what is actually needed in your environment.

Let us first start with knowing the different utilities that come by default:

adsutil.vbs - This is the most important command line utility available at your disposal. It lets you work with the entire MetaBase properties. adsutil is located at %systemdrive%/inetpub/AdminScripts/adsutil.vbs by default
Something that I recently learned: Changes made using adsutil.vbs are immediately reflected as these changes are made to the in-memory Metabase and written to the MetaBase.xml file in 2 minutes.
iisreset - This tool gives you all sort of information on Internet services running on your machine along with the ability to start, stop, restart, and reboot of the machine. This is something that I use quite often.

iisapp.vbs
- This utility comes in very handy while troubleshooting an issue. iisapp.vbs gives you the information about the w3wp.exe, it's associated PID(Process ID) and the Application Pool it corresponds to. This utility is located at %windir%\system32\iisapp.vbs

iisvdir.vbs - Lets you create, delete or query a web directory, picked the previous line directly from the help file ;). This is something that I like to user very often as it even works to find quick data from remoteIIS machines. Located at %windir%\system32\iisvdir.vbs

iisweb.vbs - You can create, delete, start, stop or pause a website using iisweb. Really helps if you want to create a website programmatic. Located at %windir%\system32\iisweb.vbs

iisback.vbs - This script lets you backup/restore your IIS settings. Actually it can do a little bit more than that :) it can also list and delete your IIS backups. But these 2 really don't matter much to any of us. iisback.vbs is also located at %windir%\system32\iisback.vbs

iisCnfg.vbs - This script can import, export and copy IIS configurations from one machine to another. To be honest, I haven't really used this one a lot and haven't seen this used in production a lot either. Located at %windir%\system32\IIsCnfg.vbs

iisext.vbs - This is a cool script to have while you are on your development machines. I like the kind of data if outputs. Basically, iisext enables you to play around with your web service extensions. Again, located at %windir%\system32\iisext.vbs

The 2 other scripts related to IIS (FTP) are: IIsFtp.vbs and IIsFtpdr.vbs also located at %windir%\system32\

So as you can see IIS doesn't ship just with cool feature set it also brings along with it great tools and scripts to make our work easier.

If you are a beginner the 1st thing I recommend is to find out how to use HELP. Simple, here is how you would get that info

ADSUTIL.VBS -
From the command prompt run
cscript.exe %systemdrive%\InetPub\AdminScripts\adsutil.vbs help
For all others:
From the command prompt run : [scriptname] /?

Majority of the help files for these tools are self explanatory and you really wouldn't much help even if you are a little accustomed to IIS.

However, I guess I will be writing a detailed post on adsutil, iisweb and iisvdir put together. That should bring more meaning to THIS post. Till then try them out, you will be relieved to see how easy they makes your daily tasks!

No Comments