Attaching the Debugger to a Script

System Center

For troubleshooting serious problems, tracing will not be as reliable or informative as a debugger. You can debug a script response by attaching the Visual Studio .NET debugger to the MOM host process.

Note Note   

Rule responses have a default timeout value of 5 minutes. You can increase the response timeout value to prevent the MOM Host process from restarting while you are debugging a script.

To attach the debugger to the MOM host application on an agent or Management Server:

  1. Start the Visual Studio .NET integrated development environment.
  2. On the Tools menu, click Debug Processes.
  3. In the Name box, type the name of the computer running the scripts.
  4. In the Available Processes list, select the appropriate instance of MOMHost.exe, and then click Attach. Debug scripts on only one agent at a time.
  5. In the Attach to Process window, select Script from the list of program types to debug, and then click OK. All other types should be cleared.
  6. In the Debugged Processes list, select the MOMHost.exe process, click Break, and then click Close to save settings.
  7. Wait for a script matching the DebugEnabledScripts registry value to run.

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

See Also

Identifying Which MOM Process to Debug | Enabling Script Debugging