SurlyJake Blog

Pstools: Access Denied in a Domain Environment

| Comments

After upgrading to a windows 7 VM at work, I was having trouble getting pstools commands to authenticate on remote machines. After much trial and error, I realized some curious behaviour with psexec. Obviously, when connecting to a remote machine, I would try to use the ‘-u’ switch to specify my administrative account, but would always get ‘access is denied’. Of course, all of the normal things should be checked: simple sharing turned off, $ADMIN share working… you know…

The issue was apparently that if I log into my workstation as a non-administrative user, but try to issue pstools commands as an administrator,  it fails because Microsoft wants me to log into my workstation and work logged with my domain admin account.

Take a look at this example using psexec: On windows 7, running ‘cmd’ as your non-admin user, if you type in the command:

1
2
3
4
5
6
7
8
9
c:\Program Files (x86)\PsTools>psexec -u domain\domainadmin \\targetmachine cmd

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Password:
Could not start PsExec service on targetmachine:
Access is denied.

If you:

  1. Hit start
  2. Type “cmd”
  3. Hold down ‘shift’ and right-click on the ‘cmd’ in the start menu
  4. Select ‘run as different user’.
  5. Type in your administrative credentials. Use the same ones you will use in the psexec command.

Now you should have your command line window open. If you run the same command as earlier:

1
2
3
4
5
6
7
8
9
10
11
c:\Program Files (x86)\PsTools>psexec -u domain\domainadmin \\targetmachine cmd

PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Password:

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Windows\system32>

Now you’re in!

Comments