RSS

check service status

02 Jun

$aryServices = “XPR Notification APL(NotApl)”,”XPR Message Router(mta)”,”XPR Name Locator(nameloc)”,”XPR Printer APL(PrintApl)”,”XPR Status Dispatcher(xmrsvc)”,”XPR Web APL(WebApl)”,”XPR TCP/IP Transport Layer(TcpApl)”,”XPR File Interface APL(FiApl)”,”XPR Information Store(infostor)”,”XPR Configuration Service(cfgsvc)”,”XPR Directory Service(DirSvc)”,”XPR Mail APL(MailApl)”,”XPR Administrator(mrs)”,”XPR ip APL(ipApl)”,”XPR License Server(licsvc)”

#add all you wanted service in the list

 

foreach ($strService in $aryServices)

{

$svrstatus = (get-service -displayname $strService).status

switch ($svrstatus)

{

running { Write-Host -foregroundcolor green “$strService started” }

stopped { Write-Host -foregroundcolor red “$strService service is already” “stopped”

  Write-Host “Starting $strService … please wait”

 #start-service $strService

}

DEFAULT { Write-Host -ForegroundColor red “did not get the ruslut” }

}

}

Advertisements
 
Leave a comment

Posted by on June 2, 2013 in others

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: