Operations Manager Debugging

I am often stopped and asked “how do you debug scripts in Operations Manager 2007”? Okay, I have been stopped once. Okay, not stopped, someone sent me an email. Okay, fine, no one knows me or cares about OpsMgr, but I still thought I should mention something about debugging scripts. Why? Because it can be a pain when trying to troubleshoot errors.

How many times have you seen an error like this one?

 

 

 

 

 

 

 

 

 

 

Trying to figure out what this all means can seem overwhelming. However, with a little analysis you can decipher exactly what happend. More importantly, you can also debug the exact script and step through to see the actual error. How? I am glad you asked.

The first piece of information to recognize is in the long error message found in the description. Pay attention to this part:

Command executed: “C:\WINDOWS\system32\cscript.exe” /nologo “SQLLiteSpeedBackupHistoryCollection.vbs”

What this means is that OpsMgr essentially tried to run this command. Simple enough, right? What this means to you is that you can run the same command! If you have access to the server on which the error occured, you can run the same command yourself and see the error as it happens. But wait, there is a few other details you need. Next up is this nugget:

Working Directory: C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 16\1738\

So, if you can access the server, you should navigate to this directory. There you will find the actual script that was executed and failed. Okay, so now you can locate the script, and execute the same command. But how to debug? No problem, just use the /X parameter. Follow these easy steps (or similar steps that achieve the same result).

  1. Connect to the server that had the issue.
  2. Open a command line
  3. Change the directory (i.e., >cd “C:\Program Files\System Center Operations Manager 2007\Health Service State\Monitoring Host Temporary Files 16\1738\”)
  4. Run the command that was executed, along with the /X parameter (i.e., C:\WINDOWS\system32\cscript.exe” /X /nologo “SQLLiteSpeedBackupHistoryCollection.vbs)

And there you go, it is that simple. Here are two additional links that help to explain how to debug Operations Manager scripts.

http://msdn.microsoft.com/en-us/library/bb437526.aspx

http://systemcenterforum.org/wp-content/uploads/Debugging_VBScript_and_Jscript.pdf

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.