'<script language="vbscript">
OPTION EXPLICIT
'on error resume next

DIM strReturn


DIM WshShell, oExec, errCode
SET WshShell = CreateObject("WScript.Shell")
SET oExec = execCmd("iisreset /status")
strReturn = oExec.StdOut.ReadAll()
errCode = oExec.ExitCode


'drop stray chars
strReturn = trim(replace(strReturn, vbCR, "")) 'CRCRLF --> CRLF
strReturn = mid(strReturn, 2)	'initial CRLF



'-- succinct
CONST spc = " 	"
' XP IIS5
strReturn = replace(strReturn, "Status for World Wide Web Publishing ( W3SVC ) :", "IIS Web" & spc)
strReturn = replace(strReturn, "Status for Simple Mail Transfer Protocol (SMTP) ( SMTPSVC ) :", "IIS SMTP" & spc)
strReturn = replace(strReturn, "Status for FTP Publishing ( MSFtpsvc ) :", "IIS FTP" & spc)
' 2000 IIS5
strReturn = replace(strReturn, "Status for World Wide Web Publishing Service ( W3SVC ) :", "IIS Web" & spc)
strReturn = replace(strReturn, "Status for Simple Mail Transport Protocol (SMTP) ( SMTPSVC ) :", "IIS SMTP" & spc)
strReturn = replace(strReturn, "Status for Network News Transport Protocol (NNTP) ( NntpSvc ) :", "IIS NNTP" & spc)
strReturn = replace(strReturn, "Status for FTP Publishing Service ( MSFTPSVC ) :", "IIS FTP" & spc)
' SBS2003 IIS6
strReturn = replace(strReturn, "Status for Microsoft Exchange Routing Engine ( RESvc ) :", "Exchange Routing" & spc)
strReturn = replace(strReturn, "Status for Microsoft Exchange POP3 ( POP3Svc ) :", "Exchange POP3" & spc)
strReturn = replace(strReturn, "Status for Microsoft Exchange IMAP4 ( IMAP4Svc ) :", "Exchange IMAP4" & spc)
strReturn = replace(strReturn, "Status for Network News Transfer Protocol (NNTP) ( NntpSvc ) :", "IIS NNTP" & spc)	'transFER
strReturn = replace(strReturn, "Status for HTTP SSL ( HTTPFilter ) :", "IIS HTTP SSL" & spc)



On Error Resume Next
wscript.Echo strReturn	'for cmd line
Echo strReturn		'for BGInfo
on error goto 0




'does sync'd WshExec
FUNCTION execCmd(p_strCmd)
	DIM oExecTemp
	Set oExecTemp = WshShell.Exec(p_strCmd)
	Do While oExecTemp.Status = 0
		On Error Resume Next
		call WScript.Sleep(100)
		on error goto 0
	Loop
	SET execCmd = oExecTemp
END FUNCTION

