使用VBscript写入应用程序和服务日志

使用VBscript写入应用程序和服务日志,vbscript,event-log,custom-eventlog,Vbscript,Event Log,Custom Eventlog,在我的PowerShell脚本中,我使用此cmdlet写入自定义日志中的应用程序和服务日志 write-eventlog -logname "MyRemoteSuite" -source "MRP" -eventid 100 -Message $Msg 它工作得很好。现在我需要对VBscript执行相同的操作。。。但EventCreate仅限于Windows事件日志。我也发现,我不知道这是否是一个好的解决方案 您能告诉我是否可以使用VBscript写入应用程序和服务日志吗?只需使用VBscri

在我的PowerShell脚本中,我使用此cmdlet写入自定义日志中的应用程序和服务日志

write-eventlog -logname "MyRemoteSuite" -source "MRP" -eventid 100 -Message $Msg
它工作得很好。现在我需要对VBscript执行相同的操作。。。但EventCreate仅限于Windows事件日志。我也发现,我不知道这是否是一个好的解决方案


您能告诉我是否可以使用VBscript写入应用程序和服务日志吗?

只需使用VBscript的
Run
方法执行PowerShell命令即可

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

谢谢你,请原谅我反应太晚了。好的,这是唯一的解决办法。。。