Writing into Application and Services Log with VBscript

1k views Asked by At

In my PowerShell script, I'm using this cmdlet for writing into Application and Services Logs in a custom log.

write-eventlog -logname "MyRemoteSuite" -source "MRP" -eventid 100 -Message $Msg

It's working well. Now I need to do the same with VBscript... But EventCreate is limited to Windows eventlog. I've found also this stackoverflow post, I don't know if it's the good solution.

Could you tell me if writing into Application and Services Logs with VBscript is possible ?

1

There are 1 answers

1
GTAVLover On

Just execute your PowerShell command using VBScript's Run Method.

Dim WshShell : Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "CMD /K POWERSHELL -Command write-eventlog -logname ""MyRemoteSuite"" -source ""MRP"" -eventid 100 -Message Msg", 1, False