Ying Li at myITforum.com

PowerShell & System Center

PowerShell script to display service status on a remote client in a colored webpage

Here is a powershell script to display service status on a remote client in a colored webpage and inspired by my friend Don Hite’s VBScript.

$a = new-object -comobject MSScriptControl.ScriptControl
$a.language = "vbscript"
$a.addcode("function getInput() getInput = inputbox(`"Enter Your Computer Name`",`"Computer Name`") end function" )
$strcomputer = $a.eval("getInput")

$ie = new-object -comobject InternetExplorer.Application
$ie.visible = $True
$ie.navigate("About:Blank")
$ie.document.title = "Service Status for $strComputer"
$ie.toolbar = ""
$ie.statusbar = ""

$colServices = [System.ServiceProcess.ServiceController]::GetServices($strComputer)
foreach($svc in $colServices)
{$strHtml = $strHtml + $svc.displayname + "(Status " + $svc.Status + ")" + "</Br>"}

$ie.Document.body.Bgcolor = "MintCream"
$ie.Document.FgColor = "MidnightBlue"
$ie.Document.Body.InnerHTML = $strHtml

Posted: Aug 14 2007, 03:11 PM by yli628 | with no comments
Filed under:

Comments

No Comments