How to resolve the algorithm Write to Windows event log step by step in the VBScript programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Write to Windows event log step by step in the VBScript programming language

Table of Contents

Problem Statement

Write script status to the Windows Event Log

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Write to Windows event log step by step in the VBScript programming language

Source code in the vbscript programming language

Sub write_event(event_type,msg)
	Set objShell = CreateObject("WScript.Shell")
	Select Case event_type
		Case "SUCCESS"
			n = 0
		Case "ERROR"
			n = 1
		Case "WARNING"
			n = 2
		Case "INFORMATION"
			n = 4
		Case "AUDIT_SUCCESS"
			n = 8
		Case "AUDIT_FAILURE"
			n = 16
	End Select
	objShell.LogEvent n, msg
	Set objShell = Nothing
End Sub

Call write_event("INFORMATION","This is a test information.")

  

You may also check:How to resolve the algorithm Inverted syntax step by step in the Swift programming language
You may also check:How to resolve the algorithm Catalan numbers/Pascal's triangle step by step in the Visual Basic programming language
You may also check:How to resolve the algorithm Generate Chess960 starting position step by step in the Befunge programming language
You may also check:How to resolve the algorithm Loops/For with a specified step step by step in the Oz programming language
You may also check:How to resolve the algorithm Deconvolution/2D+ step by step in the Go programming language