Question : Classic vbscript: at reboot, wait 10 minutes, check if (list of HostHeader sites) are running, if so, STOP

REQUEST:  Please help me create a vbscript.

My boss is the ULTIMATE scripting king.  But he likes classic vbscript, instead of powershell.

I need a vbscript for the startup group on an old 2003 webserver with about 200 hostheader websites.  

I'll schedule it (in the windows task scheduler) to run every 10 minutes or so, to ensure that our list of "abandoned" sites are not running.

In about 2 months, we'll move them to a storage area, prior to upgrading (and virtualization) to 2008.

I've got full local admin console access.

Answer : Classic vbscript: at reboot, wait 10 minutes, check if (list of HostHeader sites) are running, if so, STOP

I am familiar with IIS, I have been hosting websites on Windows for the last 10 years.

My question revolved around two things

1: many people (including myself at times XD) will interchangeably refer to entries in a host file and actual host headers on a website by the term 'host headers' -- I was hopeing to quell any confusion there due to the vagueness of your question.  You have cleared that up, much thanks.

2:  Are each of the host-headers running on a different SITE in IIS?  (this is still unanswered)
---Every SITE in IIS may have as many or as few host-headers as you like they can even reside on the SAME PORT (usually 80) if the headers for the sites are different.

that is to say in the MMC it looks something like this:

ServerName
 -- Application Pools
 -- Websites
   --- Site A
   --- Site B
   --- Site C

Each site on it's properties page obviously has the host-header settings.

My question is, what is the relationship between sites and host-headers?  are they 1 to 1? or are there many headers on one site?  All of this leads to different methods of accomplishing your goal.

Assuming the headers are 1 to 1 you can stop the sites in IIS either by hand or by script, and check to make sure those sites are stopped (However once a site is stopped in IIS it woudl NOT turn on unless you or another administrator did so manually, so it is generally pointless to keep checking, though if you insist we can do that.)

If all of the sites you want to check exist on a single site or a set of sites, and have websites there you wish to maintaining existence, than the best way woudl be to 1 determine which is the smaller list (the set of websites you want to leave on or the set you want to turn off) and move those to either a single site or one site per header.

You CANNOT turn off PART of a SITE in IIS, so the host-headers you wish to turn off MUST be in separate SITES from the host-headers you with to leave online.

If they are all in one Site, then simply removing the bad/dead/defunct host-headers from the site woudl stop IIS from responding to requests set to those addresses.

It sounds like you might be looking to be notified if someone is actually using a site though, so I would make all the addresses you are looking to turn off display a page saying "This site is currently unavailable because it is an inactive account, if you believe an error has been made and yoru account is in good standing, or would like to re-enable your web-hosting account with us please contact (Your contact info)"

 (Note: You woudl want to use a distribution group with a generic name so you can have the correct parties receive the mail and so you will be able to change the address and kill the inevitable spam once in a while)


Random Solutions  
 
programming4us programming4us