Link to home
Start Free TrialLog in
Avatar of NJThomson
NJThomson

asked on

How to monitor windows script execution

While windows scripting plays a large role in using WMI to monitor a system, I need to know if there is a mechanism to track when a script (itself) was executed the result (succes, failed/reason).

My initial thought was that WMI itself should have classes to track execution, but I don't see any classes that obviously do that.
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image


Error reporting like that must be performed within the script. Especially if it's success or failure, those terms have very little meaning outside the script.

WMI provides access to data and can help make changes, but it isn't a managed environment that will report on threads executing against it.

Chris
ASKER CERTIFIED SOLUTION
Avatar of Sander Stad
Sander Stad
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NJThomson
NJThomson

ASKER

While creating a log file for a script to write to is useful for a script under control of the author, the intent of the question was for tracking the execution of 3rd party scripts and applications.

In surfing other solutions I have found that WMI (through Win32_Process) and the management classes in .NET -  can execute any script or application (given sufficient privileges) which provides an opportunity to know what was executed, when, the execution time and the result. However, this still leaves scripts and applications that run under the windows scheduler that do not seem to be monitored and only controllable by WMI if the user doesn't modify the scheduled tasks manually on the target machine.
From the suggestion above on creating a log file through a script, it would appear that with the Scripting language's ability to run WMI queries and methods, one of which is to run an executable, then the answer would appear to be to have a script that posts a time prior to invoking the executable, then posting a time on completion along with the result (succeed, fail, etc.) - essentialy wrappering the execution.
There does not appear to be a simple way to monitor scheduled executables.