Microsoft Operations Manager |
For new scripts, use the following to achieve equivalent results.
Deprecated members | Equivalents |
---|---|
Utility.CreateProcess | Createmethod of the Win32_ProcessWMI class |
Utility.LogEvent | LogEventmethod of the WScript.Shellobject |
[VBScript]
'*********************************************************************
' Routine: Function CreateProcess
' Purpose: A replacement for the Utility.CreateProcess method
'**********************************************************************
Function CreateProcess(strEXEPath, strCommandLine, ByRef
vntExitCode)
Dim objProcess
Dim lngProcessID
Set objProcess =
GetObject("winmgmts:{impersonationLevel=impersonate}!Win32_Process")
If Not(IsNull(strCommandLine)) Then
vntExitCode = objProcess.Create(strCommandLine, Null,
lngProcessID)
Else
vntExitCode = objProcess.Create(strEXEPath, Null,
lngProcessID)
End If
Set objProcess = Nothing
CreateProcess = vntExitCode
End Function
[VBScript]
Const SUCCESS = 0
Const ERROR = 1
Const WARNING = 2
Const INFORMATION = 4
Const AUDIT_SUCCESS = 8
Const AUDIT_FAILURE = 16
'*********************************************************************
' Routine: Function LogEvent
' Purpose: A replacement for the Utility.LogEvent method
'**********************************************************************
Function LogEvent(strComputer, strDescription, lngSeverity)
Dim objShell
Dim blnSuccess
' create instance
Set objShell = CreateObject("WScript.Shell")
blnSuccess = objShell.LogEvent(lngSeverity, strDescription,
strComputer)
Set objShell = Nothing
LogEvent = blnSuccess
End Function
For more information about the Win32_ProcessWMI class, see the Windows Management Instrumentation SDK. For more information about the WScript.Shellobject, see the documentation available at the Windows Scriptsite.
Did you find this information useful? Please send your suggestions and comments about the documentation to momsdk@microsoft.com.