Controls what tracing action the script performs, START or STOP
Component
string
$Config/Parameters/Component$
Component
Controls for which HIS components tracing is enabled/disabled. ALL enables/disables tracing for all components. MANUAL enables/disables tracing per the parameter settings for individual components. EVENT enables/disables tracing for the component specified in the event or alert that triggered the script. If ALL or EVENT are specified the parameter settings for individual components are ignored.
SNABase
string
$Config/Parameters/SNABase$
SNABase
If Component=MANUAL, controls if tracing is enabled/disabled for the SNABase component
SNALU62Resync
string
$Config/Parameters/SNALU62Resync$
SNALU62Resync
If Component=MANUAL, controls if tracing is enabled/disabled for the SNALU62Resync component
SNAManageAgent
string
$Config/Parameters/SNAManageAgent$
SNAManageAgent
If Component=MANUAL, controls if tracing is enabled/disabled for the SNAManageAgent component
SNAManageClient
string
$Config/Parameters/SNAManageClient$
SNAManageClient
If Component=MANUAL, controls if tracing is enabled/disabled for the SNAManageClient component
SNAManagement
string
$Config/Parameters/SNAManagement$
SNAManagement
If Component=MANUAL, controls if tracing is enabled/disabled for the SNAManagement component
SNAPrint
string
$Config/Parameters/SNAPrint$
SNAPrint
If Component=MANUAL, controls if tracing is enabled/disabled for the SNAPrint component
SNAServer
string
$Config/Parameters/SNAServer$
SNAServer
If Component=MANUAL, controls if tracing is enabled/disabled for the SNAServer component
TN3270
string
$Config/Parameters/TN3270$
TN3270
If Component=MANUAL, controls if tracing is enabled/disabled for the TN3270 component
TN5250
string
$Config/Parameters/TN5250$
TN5250
If Component=MANUAL, controls if tracing is enabled/disabled for the TN5250 component
TraceMask
string
$Config/Parameters/TraceMask$
TraceMask
Controls which internal trace types are enabled/disabled. Specify ALL or any combination of FATAL, ERROR, DEBUG, STATE, FUNCTION, and CUSTOM.
Dim strIndent, strIndent2, strIndent3
Dim bOption, bSNABase, bSNAManagement, bSNAManageClient, bSNAManageAgent, bSNAPrint, bSNAServer, bSNALU62Resync, bTN3270, bTN5250
Dim intTraceMask
Dim strOutput, strAction, strComponent, strMask, strSource
Dim objParameters, objEvent, objAlert
Dim Service, Locator
Dim objHISTraceInst, objNewPath
strIndent=" "
strIndent2=strIndent & strIndent
strIndent3=strIndent2 & strIndent
ScriptContext.Echo("Starting HIS Tracing start/stop")
' Get script parameters
set objParameters = ScriptContext.Parameters
strAction = UCase(objParameters.get("Action"))
strMask = UCase(objParameters.get("TraceMask"))
strComponent = Ucase(objParameters.get("Component"))
ScriptContext.Echo(strIndent & "Action: " & strAction)
ScriptContext.Echo(strIndent & "TraceMask: " & strMask)
' Determine script action - start or stop tracing. bOption is
' used to enable/diable the tracing options for each component
' that are not controlled by the trace mask.
if strAction = "STOP" then
bOption = False
elseif strAction = "START" then
bOption = True
else
ScriptContext.Echo(strIndent & "Invalid Action parameter. Valid options are START and STOP.")
end if
' Determine the trace mask to use in enabling tracing. If this is a STOP action
' then set trace mask to none (tracing off), otherwise check value and if necessary parse
' parameters to build trace mask.
if strAction = "STOP" then
intTraceMask = HIS_TRACE_NONE
else
if (strMask="" OR strMask = "ALL") then
intTraceMask=HIS_TRACE_ALL
else
if InStr(strMask,"FATAL") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_FATAL
if InStr(strMask,"ERROR") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_ERROR
if InStr(strMask,"DEBUG") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_DEBUG
if InStr(strMask,"STATE") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_STATE
if InStr(strMask,"FUNCTION") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_FUNC
if InStr(strMask,"CUSTOM") <> 0 then intTraceMask = intTraceMask + HIS_TRACE_CUSTOM
end if
end if
' Determine which components to update. Based on parameters set a boolean variable
' for each component, which is referenced when updating the WMI classes. If Component
' parameter = EVENT, get the event/alert that triggered the script and the associated source
' value, and then match that to the appropriate WMI tracing class. If Component parameter = MANUAL,
' get and evaluate the parameters for individual components. If Component parameter = ALL, set
' all components for update.
ScriptContext.Echo(strIndent & "Component: " & strComponent)
' EVENT
if strComponent = "EVENT" then
if ScriptContext.IsEvent() then
set objEvent=ScriptContext.Event
strSource = UCase(objEvent.EventSource)
ScriptContext.Echo(strIndent & "Event source: " & strSource)
MatchSource
elseif ScriptContext.IsAlert() then
set objAlert=ScriptContext.Alert
strSource = Ucase(objAlert.AlertSource)
ScriptContext.Echo(strIndent & "Alert source: " & strSource)
MatchSource
else
ScriptContext.Echo(strIndent & "Not called by an event or alert, invalid Component setting.")
ScriptContext.Echo(strIndent & "SNABase: " & bSNABase)
ScriptContext.Echo(strIndent & "SNAManagement: " & bSNAManagement)
ScriptContext.Echo(strIndent & "SNAManageClient: " & bSNAManageClient)
ScriptContext.Echo(strIndent & "SNAManageAgent: " & bSNAManageAgent)
ScriptContext.Echo(strIndent & "SNAServer: " & bSNAServer)
ScriptContext.Echo(strIndent & "SNAPrint: " & bSNAPrint)
ScriptContext.Echo(strIndent & "SNALU62Resync: " & bSNALU62Resync)
ScriptContext.Echo(strIndent & "TN3270: " & bTN3270)
ScriptContext.Echo(strIndent & "TN5250: " & bTN5250)
ScriptContext.Echo("Invalid Component setting. Valid options are ALL, EVENT, and MANUAL")
end if
' Update the necessary WMI tracing classes. For each supported tracing component,
' evaluate the associated boolean vlaue and if necessary get, update, and put the
' instance to perform the update. If Print, TN3, or TN5 are specified then SNABase
' and SNAServer are also always changed.
' Get connected to WMI.
' The second call returns a SWbemServices object ("Service")
Set Locator = CreateObject("WbemScripting.SWbemLocator")
if ScriptContext.isTargetAgentless then
Set Service = Locator.ConnectServer(ScriptContext.TargetNetBiosComputer, "root\MicrosoftHIS")
else
Set Service = Locator.ConnectServer(".", "root\MicrosoftHIS")
end if
' WMI class updates
' SNABase
if bSNABase or bSNAPrint or bTN3270 or bTN5250 or bSNALU62Resync then
set objHISTraceInst = Service.Get("MsHisTrace_SNABase=@")
set objNewPath = objHISTraceInst.Put_
CheckErr Err, "TN5250"
end if
ScriptContext.Echo("End HIS Tracing start/stop")
End Sub
Sub CheckErr(Err, strClass)
if Err = 0 then
ScriptContext.Echo(strIndent & strClass & " tracing changed")
else
ScriptContext.Echo(strIndent & "Error changing " & strClass & " tracing. Error code: " & Err)
end if
End Sub
Sub MatchSource()
Select Case strSource
Case "SNA BASE SERVICE"
bSNABase = True
ScriptContext.Echo(strIndent & "SNABase: TRUE")
Exit Sub
Case "SNA MANAGE CLIENT"
bSNAManageClient = True
ScriptContext.Echo(strIndent & "SNAManageClient: TRUE")
Exit Sub
Case "SNA MANAGE AGENT"
bSNAManageAgent = True
ScriptContext.Echo(strIndent & "SNAManageAgent: TRUE")
Exit Sub
Case "SNA SERVER"
bSNAServer = True
ScriptContext.Echo(strIndent & "SNAServer: TRUE")
Exit Sub
Case "SNA PRINT SERVER"
bSNAPrint = True
' Print should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent & "SNAPrint: TRUE")
ScriptContext.Echo(strIndent & "SNABase: TRUE")
ScriptContext.Echo(strIndent & "SNAServer: TRUE")
Exit Sub
Case "TN3270 SERVER"
bTN3270 = True
' TN3 should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent & "TN3270: TRUE")
ScriptContext.Echo(strIndent & "SNABase: TRUE")
ScriptContext.Echo(strIndent & "SNAServer: TRUE")
Exit Sub
Case "SNA TN5250 SERVER"
bTN5250 = True
' TN5 should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent & "TN5250: TRUE")
ScriptContext.Echo(strIndent & "SNABase: TRUE")
ScriptContext.Echo(strIndent & "SNAServer: TRUE")
Exit Sub
Case "SNA LU6.2 RESYNC TP"
bSNALU62Resync = True
' LU resync should also enable SNAServer and SNABase
bSNAServer = True
bSNABase = True
ScriptContext.Echo(strIndent & "SNALU62Resync: TRUE")
ScriptContext.Echo(strIndent & "SNABase: TRUE")
ScriptContext.Echo(strIndent & "SNAServer: TRUE")
Exit Sub
Case Else
' unknown or unsupported component
ScriptContext.Echo(strIndent & strSource & " is not a known component or does not support tracing. Tracing not enabled.")