Option Explicit '************************************************************************* ' Script Name - Start Messenger Service ' ' Purpose - To Restart the Messenger Service when it stops ' locally on the agent ' ' Parameters - None ' ' (c) Copyright 2004, Microsoft Corporation, All Rights Reserved ' Proprietary and confidential to Microsoft Corporation ' ' This sample is provided "as is" for informational purposes only ' and Microsoft makes no warranties, either express or implied, of ' fitness for a particular purpose, of accuracy or completeness of ' responses, of results, or conditions of merchantability. No ' technical support is provided. ' '****************************************************************************** Dim objSvc Dim retval ' Get the Messenger service object. Set objSvc = GetObject("WinMgmts::Win32_Service='Messenger'") ' Start the Messenger service. retval = objSvc.StartService() ' Check the return value for StartService. If (retval <> 0) Then ' The service failed to start. ' Create an event using the MOM ScriptContext object. Dim objEvt Set objEvt = ScriptContext.CreateEvent objEvt.Message = "The Messenger service failed to start." objEvt.EventType = 2 ' 2 = EVENTLOG_WARNING_TYPE ' Submit the event to MOM. ScriptContext.Submit(objEvt) ' Free the event object. Set objEvt = Nothing End If Set objSvc = Nothing