Creating Web Sites on IIS 5

August 20th, 2006

Creating Web Sites on IIS 5

MkW3Site.vbs is a WSH script installed by default to the \inetpub\scripts directory when you install Windows 2000. (You can download MkW3Site.vbs from the Code Library on the IIS Administrator Web site at http://www.iisadministrator.com.)

This powerful script creates Web sites for you. MkW3Site.vbs takes 10 possible parameters.

Parameters for MkW3Site.vbs

Switch Name Notes
—r RootDirectory Home directory of the site (e.g., \inetpub\wwwroot).
—t Comment Server comment, often called Web site name
    (e.g., Default Web site).
—c Computer Computer(s) on which to install in the format
    COMPUTER1[,COMPUTER2...]]
—h HostName The host name of the Web site for host headers.
    (Warning: Use HostName only if DNS is set up to find the server.)
—o Port The port number to assign to the new server.
—I IPAddress The IP address to assign to the new server.
—n SiteNumber The number in the path at which the Web server will be created
    (e.g., w3svc/3).
—DontStart DontStart Don’t start the Web server after it’s created.
—v Verbose Verbose mode.
—? Help Display usage.

MkW3Site.vbs isn’t pathed (i.e., placed in a folder that Windows locates automatically by default), so you need to navigate to the \inetpub\scripts directory to execute it. In addition, creating Web sites requires a security privilege, so make sure you’re authenticated as a member of the local administrators group on the server you’re using. Alternatively, you can use the command-line utility Runas to impersonate a user when you run the script.

Although you can run MkW3Site.vbs in CScript or WScript, I recommend CScript so that all screen output is directed to the command window from which you run the code. WScript initiates a series of pop-up windows that you have to close by clicking OK. I executed the command

CScript mkw3site.vbs —r e:\ _
inetpub\wwwroot\sitepath _
—t "sitename" —h _
www.sitedomain.com —n 3 —v

Also read this article on setting values in the metabase

Remote Shutdown of a PC

November 19th, 2005

I got into a bit of a problem with a server that was being a bit of a pain and after googling for a while discovered that you can issue a command using the command line to the remote machine like this:

shutdown /r /m \\remoteComputer \f \c “The reason why”

/f forces the shutdown and may not be necessary

/r restarts the remote machine

/m means it is expecting a machine 

/c comment

note the name of the remote computer is preceded by \\ e.g. \\193.168.1.123

Useful site with Win 2003 tips

http://www.computerperformance.co.uk/index.htm