This was an error I saw when trying to query Remote Desktop Services users and shadow sessions. On running the command to query users the following output was given;
Error 0x00000005 enumerating sessionnames
Error :Access is denied.
If I ran the same query using psexec for the command to run locally on the server, this worked fine and also proved that this wasn’t just an authentication problem;
psexec \\londonrds01 "quser"
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
remoteuser12 rdp-tcp#0 1 Active 1 08/07/2013 10:29
quser exited on londonrds01 with error code 0.
Then, now knowing the session details I attempted to shadow the session using both session number and name;
shadow 1 /SERVER:londonrds01
Session ID 1 not found
shadow rdp-tcp#0 /SERVER:bkln1papp07
Session rdp-tcp#0 not found
After some Googling around the error and checking a few things, it came down to remote RPC calls now being allowed on the server. A quick registry change was all that was required without a restart. Change the value of the key from 0 to 1