This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Automatic Service Monitoring

Hi,

We have written a power shell script to monitor the windows automatic services and we have tested the script in destination server. PFB SS

Also we have created a custom windows power shell template in solar winds, but we are getting error. PFB SS for the same.

Can any one please help us to resolve the issue.

attachments.zip
  • vigneshwar​ you should probably read this Thwack article

    The Basics of PowerShell (part 3)

    your script is missing some of the requirements to work with SAM and that Thwack article should be able to get you on the right track.

  • Kind of an old thread, but were you able to resolve it with christopher.t.jones123​ Links and suggestions?

    If not let us know so we can point you further to the Powershell monitoring basics.

  • I am getting below error for automatic services script 

    Output Failed:{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""

    Can some please help me and below is VB script I am using

    Option Explicit
    Const SUCCESS = 0, FAIL = 1, wbemFlagReturnImmediately = &h10, wbemFlagForwardOnly = &h20
    Dim strComputer, strUser, strPassword, sCount, strServiceList, objItem, colItems, objSWbemLocator, objSWbemServices
    Dim objArgs
    Set objArgs = WScript.Arguments
    'Use the following syntax for Script Arguments field in APM Monitor script:
    '${IP} ${USER} ${PASSWORD}

    strComputer = objArgs(0)
    strUser = objArgs(1)
    strPassword = objArgs(2)

    Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
    Set objSWbemServices = objSWbemLocator.ConnectServer _
    (strComputer, "root\cimv2", "strUser", "strPassword")
    objSWbemServices.Security_.ImpersonationLevel = 3
    Set colItems = objSWbemServices.ExecQuery("SELECT * FROM Win32_Service where StartMode = 'Auto' and State = 'Stopped' and not name like 'sppsvc' and not name like 'OracleRemExecService' and not name like 'OracleProcessManager' and not name like 'ShellHWDetection' and not name like 'TrustedInstaller' and not name like 'stisvc' and not name like 'CcmExec' and not name like 'clr_optimization_v4.0.30319_64' and not name like 'clr_optimization_v4.0.30319_32' and not name like 'ccmsetup' and not name like 'BITS' and not name like 'nsrpsd' and not name like 'RemoteRegistry' and not name like 'gupdate'", "WQL", _
    wbemFlagReturnImmediately + wbemFlagForwardOnly)

    sCount=0
    For Each objItem In colItems
    Select Case objItem.Name
    'If a service name is listed in the following Case statement, it will be ignored.
    'The service name is case sensitive and must be an exact match.
    Case "SysmonLog"
    Case Else
    If sCount=0 Then
    strServiceList = objItem.DisplayName
    Else
    strServiceList = strServiceList & ", " & objItem.DisplayName
    End If
    sCount = sCount + 1
    End Select
    Next

    If sCount > 0 Then
    WScript.Echo "Message: Auto Start Services Down: " & strServiceList
    WScript.Echo "Statistic: " & CStr(sCount)
    WScript.Quit(SUCCESS)
    Else
    WScript.Echo "Message: All Auto Start Services Are Up"
    WScript.Echo "Statistic: 0"
    WScript.Quit(SUCCESS)
    End If