query session command gives error code 5 even when AllowRemoteRPC is set to 1
Rather than changing registry values, you could always use PSEXEC
from a command prompt or Invoke-Command from a PowerShell prompt to execute QWINSTA
locally. Both of these will require you have administrative rights on the remote machine (which means opening the command prompt under other credentials, including the credentials as PSEXEC
switches or, in the case of PowerShell, including -Credential (Get-Credential)
in the command.
Command prompt example:
PSEXEC \\MYPC cmd /c "qwinsta /server:localhost"
PowerShell example:
Invoke-Command -ComputerName MyPC -ScriptBlock { qwinsta /server:localhost }