I work at a company that has many VBScripts that regularly have error messages. Until recently we had to go into the server and look for these errors. I have put together a script using:
Get-Process| Where-Object {$_.ProcessName -eq "wscript" -and $_.mainwindowtitle -eq "Windows Script Host"}
with
$NewErrorScript = Get-WmiObject win32_process -Filter "name='wscript.exe'" | Select-Object Commandline
This is working well to determine if a specific script has a error message open, however I would like to know if there is any way to tell the error reason. Is there any way to get more information or the complete error message? In addition, a way to read any open message box content would also be very helpful. Thanks!