Using psexec to change Remote local group - getting access denied RRS feed

  • Question

  • I am using psexec to add a user to the Remote Desktop users group of a remote machine. I am using the local Administrator account username and password of that remote machine as I don't have admin rights on that machine using my ID.

    When I run the command from my machine I get access denied. The username and password for the remote Administrator account works because I can remote into the machine with it. Any ideas why using the psexec method does not work?

    The command I am running is below:

    psexec \\<machine> -h -u machine\Administrator -p password net localgroup "Remote Desktop Users" user1 /add


    Thursday, June 13, 2019 8:21 PM

All replies

  • WHat is the returned error?

    Can you try a double steps execution?

    psexec \\<machine> -h -u machine\Administrator -p password cmd.exe

    When you get the prompt, execute the second command:

    net localgroup "Remote Desktop Users" user1 /add

    Do you get the same problem? What is the returned error? DId you try withouth the "-h" parameter and eventually using the "-s" to start the process as Local System on the remote machine?



    Monday, June 17, 2019 11:34 AM
  • Hi, The returned error is Simply: Access Denied.Also, I have tried with and without the -h switch as well as using an elevated and non-elevated command prompt window to run the psexec command.

    Monday, June 17, 2019 2:27 PM
  • I also tried your method of running cmd.exe first and it also fails with Access Denied. For some reason the machine wont let me run these commands even though the credentials are correct.
    Monday, June 17, 2019 2:35 PM
  • Maybe this will help.

    It's the UAC.. try creating the key as shown by the article.


    Tuesday, June 18, 2019 10:25 AM