Microsoft Operations Manager

Debugging Scripts

Debugging Scripts with Microsoft Visual Studio .NET

Debug MOM scripts either from the local computer or a remote computer using Microsoft Visual Studio .NET. Once the debugger is connected to the OnePoint service, you can step through scripts, set breakpoints, view the call stack, examine variables and objects, and use other debugging features in the Visual Studio .NET development environment. You can debug scripts running on either the MOM Consolidator computer or an agent computer.

Installing Remote Debugging Components

To support remote debugging, install the full set of Visual Studio .NET debugging components on the computer running the script.

To install the remote debugging components on an agent computer or a Consolidator

  1. From the Visual Studio .NET CD or DVD, run Setup.
  2. In the Visual Studio .NET Setupwindow, click Remote Components Setup.
  3. On the Remote Component Setuppage, scroll to the Full Remote Debugging supportarea, and then click Install Full.
  4. Click OKafter the installation is complete.

Enabling Debugging

The default settings on the MOM Consolidator and agents do not support attaching a debugger to the running MOM scripts. You must enable debugging through the Windows registry.

For scripts that run on agent computers, enable debugging on each agent computer you are debugging. If a script runs on the Consolidator, enable debugging on the Consolidator computer. This also allows you to debug agent scripts running on the Consolidator.

To turn debugging on and specify which scripts you want to debug

  1. Run Windows Registry Editor (Regedit.exe).
  2. Browse to the HKEY_LOCAL_MACHINE\SOFTWARE\Mission Critical Software\OnePointregistry key.
  3. Change the value of the DebugEnabledScriptsentry to specify the name of the script or scripts you want to debug. Wildcard expressions are supported for this setting. If DebugEnabledScriptsdoes not already exist, create a new Stringentry for it.
  4. To enable debugging, change the value of the EnableActiveDebuggingentry to 1. If EnableActiveDebuggingdoes not already exist, create a new DWORDentry for it.

To disable debugging, change EnableActiveDebuggingto 0.

Note  Note   

Disable debugging after you have finished troubleshooting the problem. Enabling debugging will decrease performance, and other users could attach debuggers to the OnePointService.exe process and lock threads for extended periods of time.

Attaching the Debugger to MOM

To attach the debugger to an agent or Consolidator

  1. Start the Visual Studio .NET integrated development environment.
  2. On the Toolsmenu, click Debug Processes.
  3. In the Processesdialog box, type the name of the computer running the scripts in the Namebox.
  4. In the Available Processeslist, select OnePointService.exe, and then click Attach. Debug scripts on only one agent at a time.
  5. In the Attach to Processwindow, select Scriptfrom the list of program types to debug, and then click OK. All other types should be cleared.
  6. In the Debugged Processeslist, select the OnePointService.exeprocess, click Break, and then click Closeto save settings.
  7. Wait for a script matching the DebugEnabledScriptsregistry value to run.

To end the debugging session and detach from the OnePoint service, press Shift+F5 .

Debugging the Script

The first script matching the name or wildcard pattern specified in the DebugEnabledScriptsregistry entry opens in Visual Studio .NET. You can use the commands on the Debugmenu. You can also view the data displayed in the various debugging windows, such as the Localswindow and the Call Stackwindow. For more information about debugging with Visual Studio .NET, see Using the Debuggerin the Visual Studio .NET documentation.

When debugging MOM scripts, use the following guidelines:

For more information about testing MOM scripts, see the MOM SDK for documentation about the RunScript.exe utility.

See Also

Remote Debugging Setup, Using the Debugger


Did you find this information useful? Please send your suggestions and comments about the documentation to momsdk@microsoft.com.