Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to quickly be able to check whether a site is online after logging into the desktop of Windows Server 2008 R2 (x64). I would prefer to be able to do this in just 1 single or double-click (or better yet, without clicking at all) than to have to navigate the tree structure of the IIS Manager.

I can make a shortcut to IIS Manager and put it on my desktop, but how do I force it to open to the SERVERNAME/Sites view rather than clicking several times to get there?

If it can't be done, is there some other way without doing programming that I can put an "online/offline" indicator (preferably in the system tray or on the desktop) for each site I want to put there?

If I have to resort to programming for this seemingly simple feature, how can I get the status (started or stopped) for a specific IIS web site to be shown in my custom program? What API, file, or registry entry do I need to read to get this status info?

Update

I discovered someone else with a .bat file that used the appcmd.exe IIS utility. After some trial and error after reading the MSDN documents about the appcmd.exe utility, I was able to piece together the following .bat file that does the job nicely. The task at hand was simply to get a site (or multiple site's) state in 2 clicks or less from the desktop.

@echo off

:Status
Set STATUS1=MAINTENANCE
FOR /F "tokens=*" %%A IN ('%SystemRoot%\System32\inetsrv\appcmd list site /site.name:www.mysite1.com /text:state ^| FIND "Started"') DO SET STATUS1=STARTED

Set STATUS2=MAINTENANCE
FOR /F "tokens=*" %%A IN ('%SystemRoot%\System32\inetsrv\appcmd list site /site.name:www.mysite2.com /text:state ^| FIND "Started"') DO SET STATUS2=STARTED

echo www.mysite1.com: %STATUS1%
echo www.mysite2.com: %STATUS2%

pause

Unfortunately, the utility is not documented very well - I had to tinker with it quite a bit to get the result I wanted.

%SystemRoot%\System32\inetsrv\appcmd list site /site.name:www.mysite1.com

This is the line that gets the status, but running it like this returns a bunch of other stuff too. So, in order to just get the status and nothing else, another parameter must be added.

%SystemRoot%\System32\inetsrv\appcmd list site /site.name:www.mysite1.com /text:state

Following the example in the link, I was also able to put together a menu to instantly start and stop the sites by pressing a key and then ENTER, and then it displays the status of the sites again - all from one .bat file.

share|improve this question
add comment

3 Answers

If you have the 'IIS Management Scripts and Tools' enabled, you can use PowerShell to show the status of the sites. I use a script like this in a dedicated PowerShell window:

do
{
     clear-host
     Get-ChildItem IIS:\sites | format-table state, name
     $curPos = $Host.UI.RawUI.CursorPosition
     $ou = (Get-Date).ToString("HH:mm:ss")
     $ou = "  " +  $ou + " - Press CRTL+C to terminate"
     $Host.UI.Write($ou)
     $Host.UI.RawUI.CursorPosition=$curPos 
     Start-Sleep -Seconds 5
} until ($false)

The line

Get-ChildItem IIS:\sites | format-table state

does the real work, the rest is just there to keep the output from scrolling. It updates every five seconds.

share|improve this answer
add comment

I am sorry to say, but the short answer is no. Check out the configuration reference here: http://www.iis.net/configreference or the cmdlet reference here: http://technet.microsoft.com/en-us/library/ee790599.aspx

I checked out the XML file, but there is nothing that allows you to choose where you start. They really should add that.

share|improve this answer
    
Thanks for looking into this. However, as they say there is more than one way to skin a cat. I found a solution to getting this info by using the appcmd.exe IIS utility. –  NightOwl888 May 21 '11 at 16:09
    
I am glad you found a work around. –  KCotreau May 21 '11 at 20:29
add comment

Did you try appcmd.exe list sites, the output is something like

SITE "Default Web Site" (id:1,bindings:http/*:80:,state:Started)

You can refer the article

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.