Troubleshooting Session Shadowing
If you try to shadow a user session and can't, there are a couple of steps you can take to troubleshoot the problem.
First, make sure that the user's session is allowed to be shadowed. This setting can be configured through Group Policy (for users or computers), the user account properties, or in RD Session Host Configuration. If you find that the settings in these areas are set correctly and you are still being denied, check with the user. It might be that the user is mistakenly answering "No" to the request to let you remote-control the session.
Second, use the error messages to help you diagnose the problem. Any error messages that you might receive when trying to shadow a session are most helpful when you're trying to shadow a session from the same server as the session you're trying to shadow is connected to. For instance, if you are trying to shadow a user session from the same server that the user is logged on to, and RD Session Host Configuration is set not to allow remote control, you will receive a message like this.
shadow 3 Your session may appear frozen while the remote control approval is being negotiated. Please wait... Remote control failed. Error code 7051 Error [7051]:The requested session is not configured to allow remote control.
However, if you are initiating the shadowing operation from a computer other than the one that hosts the session that you want to shadow, you will not get such a straightforward message. Instead, if there's a problem, you will receive a cryptic message like this.
shadow 3 /SERVER:FUJI Your session may appear frozen while the remote control approval is being negotiated. Please wait... Remote control failed. Error code 2 Error [2]:The system cannot find the file specified.
Typically, if you see error code 2, it means either that the user denied your request to shadow the session or shadowing the session is not allowed.
If you'd like to save yourself the trouble of trying three different tools to find the current Remote Control settings and where they're set, query the Win32_TSRemoteControlSetting Windows Management Instrumentation (WMI) class from Windows PowerShell.
NOTE The methods and properties for this class can be found at http://msdn.microsoft.com /en-us/library/aa383817(VS.85).aspx.
To view the Remote Control settings for a computer, open Windows PowerShell and enter the following command.
get-wmiobject -namespace "root\cimv2\terminalservices" -class Win32_TSRemoteControlSetting
The important part of the output is at the bottom, where you'll see values such as this.
Caption : Description : InstallDate : LevelOfControl : 0 Name : PolicySourceLevelOfControl : 0 RemoteControlPolicy : 1 Status : TerminalName : RDP-Tcp
The key properties LevelOfControl, PolicySourceLevelOfControl, and RemoteControlPolicy provide answers to the following questions: Do you have permission to shadow this session? Where is this policy set?
The Windows PowerShell script, Shadowcheck.ps1, helps automate the commands detailed here.
LevelOfControl can have values from 0 to 4, with the following meanings.
- 0 = Remote control is disabled.
- 1 = Administrator has full control; user must grant permission to be shadowed.
- 2 = Administrator has full control; user permission is not required.
- 3 = Administrator can view the shadowed session; user must grant permission to be shadowed.
- 4 = Administrator can view the shadowed session; user permission is not required.
The PolicySourceLevelOfControl shows where the value of LevelOfControl comes from. A value of 0 means that this value is set on a per-server basis, a value of 1 indicates that it's set by Group Policy, and a value of 2 means that it's the user account policies.
The value of the RemoteControlPolicy property indicates whether Remote Control settings are configured on a per-user basis (1) or a per-server basis (0).
You can observe the changes to these settings by editing the Remote Control settings from RD Session Host Configuration. Try editing the settings to see how the value of the LevelOfControl property changes when you disable remote control, and you'll see the value change when you run the script.
Another reason you might see errors when trying to shadow sessions has to do with screen size. If you try to shadow a session that is using one monitor from another session that is spanning multiple monitors, you will not be able to shadow the session. Trying to shadow from a Windows 7 client using multiple monitors to a session using fewer monitors results in the session being disconnected and you will get the following error.
Remote control failed. Error code 120 Error [120]:This function is not supported on this system.
NOTE: Shadowing from a Windows XP client to an RD Session Host server remote session does not work. It results in the session being disconnected, and you will get this error.
Remote control failed. Error code 31 Error [31]:A device attached to the system is not functioning.
In this tutorial:
- Managing Remote Desktop Session
- Introducing RD Session Host Management Tools
- Command-Line Tools
- Connecting Remotely to Servers for Administrative Purposes
- Managing RD Session Host Servers from Windows 7
- Organizing Servers and VMs in the Remote Desktop Services Manager
- Monitoring and Terminating Processes
- Terminating Applications
- Monitoring and Ending User Sessions
- Closing Orphaned Sessions
- Disconnecting Sessions
- Providing Help with Remote Control
- Enabling Remote Control via Group Policy
- Enabling Remote Control via RD Session Host Configuration
- Shadowing a User Session
- Troubleshooting Session Shadowing
- Preparing for Server Maintenance
- Sending Messages to Users
- Shutting Down and Restarting RD Session Host Servers
- Applying RDS Management Tools
- Get the Server Names
- List Processes on the RD Session Host Servers
- Auditing User Logons
- Closing Unresponsive Applications