0

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 ?

mrplume
  • 183
  • 1
  • 3
  • 18

1 Answers1

0

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
GTAVLover
  • 1,407
  • 3
  • 22
  • 41