You cannot debug through a Terminal Server session

This article was previously published under Q323478
This article has been archived. It is offered "as is" and will no longer be updated.
When you try to attach a native debugger over Terminal Services to a process that runs in another WinStation (including system processes), you receive the following error message:
Win32 error 5
"Access is denied."
Also, if you run AutoDump+ (which scripts the cdb.exe debugger) in -crash mode, you receive an error message similar to the following:
Autodump+ has detected that you are attempting to run in "Crash" mode, but this account is currently logged into terminal server session ID:RDP-TCP#8. "Crash" mode (invoked via the -crash switch) does not work inside a terminal server session. To run Autodump+ in "Crash" mode, please log in locally at the console.
The debugger cannot attach to a process that runs in another WinStation.
To work around this problem, you can attach noninvasively by using the -pv switch. Alternatively, you can schedule a task remotely by using the Task Manager or the AT.exe utility. You can either schedule the debugger to run, or you can schedule a remoted Cmd window.

To use the Task Manager

  1. Start Windows Explorer, and then locate \\remotemachinename.
  2. Double-click the Scheduled Tasks icon.
  3. On the File menu, click New, and then click Scheduled Task.
  4. Give the new task a name, and then double-click the task to set the properties.
  5. In the Run box, type one of the taskcommands described below.
  6. On the Schedule tab, set the time for the task to start.

    NOTE: Make sure you give a username and a password when you are prompted.

To use the AT.exe utility

  1. From the command prompt, type:

    at.exe \\remotemachinename 12:00 taskcommand
  2. Replace 12:00 with the time to start the task.
  3. Replace taskcommand with one of the taskcommands below:
  • To start your debugger directly (for example, adplus in -crash mode):
    • c:\winnt\system32\cscript.exe "c:\program files\debugging tools for windows\adplus.vbs" -crash -iis -quiet

      NOTE: When you start adplus.vbs remotely, remember to use the -quiet switch and to check the .log file for status.
  • To start a remoted Cmd window:
    • "c:\program files\debugging tools for windows\remote.exe" /s cmd myremotedcmd
    • To connect from the client, you can run remote /c remotemachinename "myremotedcmd".
This behavior is by design.

Article ID: 323478 - Last Review: 02/27/2014 21:13:36 - Revision: 2.3

  • Microsoft Windows NT Server 4.0, Terminal Server Edition
  • Microsoft Windows 2000
  • kbnosurvey kbarchive kbprb KB323478