'**********************************************************************
'**                                     
'**  MOM Administration Check Action Account
'**                                    
'**  Author: Jesse.Harris
'**  Date: 11/20/05
'**  Notes: This script is used to verify a particular action account.
'**           
'**           
'**  Revision History:                         
'**                                 
'**  Date    Author        Comment                 
'**********************************************************************
'On Error Resume Next
Const EVENT_TYPE_SUCCESS        = 0
Const EVENT_TYPE_ERROR          = 1
Const EVENT_TYPE_WARNING        = 2
Const EVENTLOG_INFORMATION_TYPE = 4
Const EVENTLOG_AUDIT_SUCCESS    = 8
Const EVENTLOG_AUDIT_FAILURE    = 16
Const CHECK_ACTION_ACCOUNT = 600
Const SCRIPT_FAILURE_EVENT = 91001

Set objParameters = ScriptContext.Parameters
LogSuccess = ucase(objParameters.get("LogSuccess"))
UserName = ucase(objParameters.get("ActionAccountID"))



Set objNTSystemInfo = CreateObject("WinNTSystemInfo")           
sUser = ucase(objNTSystemInfo.UserName)
Set objNTSystemInfo = nothing

if sUser <> UserName Then
    LogEvent CHECK_ACTION_ACCOUNT,EVENT_TYPE_ERROR,"The MOM Service is using the wrong action account." & vbcrlf & "Action Acct: " & sUser & vbcrlf & "Desired Acct: " & UserName
elseif LogSuccess = "TRUE" Then
    LogEvent CHECK_ACTION_ACCOUNT,EVENT_TYPE_SUCCESS,"The MOM Service is using the correct action account." & vbcrlf & "Action Acct: " & sUser & vbcrlf & "Desired Acct: " & UserName
end if
   
if err.number <> 0 Then
    LogEvent SCRIPT_FAILURE_EVENT,EVENT_TYPE_ERROR,"Script Error: " & vbcrlf & "err.number: " & err.number & vbcrlf & "err.description : " & err.description
end if  
   

Sub LogEvent(lEventID, lEventType, lEventMessage)
   
    Dim oEvent
    Set oEvent = ScriptContext.CreateEvent
    oEvent.EventNumber = lEventID
    oEvent.EventType = lEventType
    oEvent.Message = lEventMessage
    ScriptContext.Submit oEvent
    Set oEvent = nothing
   
    Set objShell = CreateObject("WScript.Shell")
    objShell.LogEvent 4, "MOM Script: " & ScriptContext.Name & "     MOMEventID: " & lEventID & "     MOMEventType: " & lEventType & "     MOMEventMsg: " & lEventMessage
    set objShell = nothing

End Sub