If IsNull(ForefrontInstallPath) Then
WriteMOMEvent "TASK ERROR: Unable To Retrieve Forefront for SharePoint Installation Path", 1, INSTALL_PATH_FAIL
ScriptContext.Quit
End If
If TextLogParameter = "true" then
CreateLogFolder(ForefrontInstallPath)
End If
WriteLog "NULL"
WriteLog "Beginning Check the number of FSSP Realtime Scanner and log to MOM Logs Called by " & Caller
Dim objFSO
set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(ForefrontInstallPath & "\MOMLogs") = 0 then
objFSO.CreateFolder(ForefrontInstallPath & "\MOMLogs")
End If
Set objFSO = Nothing
End Function
'***********************************************************************
'*
'* Function: WriteLog()
'*
'* Purpose: Writes script activity and errors to a log file
'*
'***********************************************************************
Function WriteLog (strLogText)
Dim objfs
Dim objf
Dim strTimeStamp
If TextLogParameter = "true" Then
On Error Resume Next
Err.Clear
Set objfs = CreateObject("Scripting.FileSystemObject")
Set objf = objfs.OpentextFile(ForefrontInstallPath & "\MOMLogs\" & "Tasks.log", 8, False)
' If log file doesn't exist - create it
If Err.Number <> 0 Then
Set objf = objfs.CreatetextFile(ForefrontInstallPath & "\MOMLogs\" & "Tasks.log", False)
Err.Clear
End If
If strLogText = "NULL" then
objf.WriteLine("")
Else
strTimeStamp = Date & " " & Time & " "
objf.WriteLine(strTimeStamp & strLogText)
End If
End If
'********************************************************************
'*
'* Function: RetrieveRegValue
'*
'* Purpose: Retrieves String Value from Registry
'*
'********************************************************************
Function RetrieveRegValue (Key, strValueName, intValueType)
' intValueType -> 1 = String Value
' -> 2 = DWORD Value
const HKEY_LOCAL_MACHINE = &H80000002
Dim strServerName
Dim objReg
Dim strRegValue
On Error Resume Next
Err.Clear
Set objReg=GetObject("winmgmts:\root\default:StdRegProv")
If Err.Number <> 0 Then
Err.Clear
strRegValue = NULL
Else
Select Case intValueType
Case 1
strErr = objReg.GetStringValue (HKEY_LOCAL_MACHINE, Key, strValueName, strRegValue)
Case 2
strErr = objReg.GetDWORDValue (HKEY_LOCAL_MACHINE, Key, strValueName, strRegValue)
End Select
' if reading the registry fails via wmi return error
If strErr <> 0 then
strRegValue = NULL
End If
End If