Posts Tagged ‘ psexec

Pstools: Access Denied in a Domain Environment

After upgrading to a 7 VM at work, I was having trouble getting commands to authenticate on remote machines. After much trial and error, I realized some curious behaviour with . 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:

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:

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!

Remotely change power options in XP

First of all, get the and set them up. then run

 \\[workstation name] powercfg /query
Field Description          Value
-----------------          -----
Name                       Home/Office Desk
Numerical ID               0
Turn off monitor (AC)      After 20 mins
Turn off monitor (DC)      After 5 mins
Turn off hard disks (AC)   After 60 mins
Turn off hard disks (DC)   After 10 mins
System standby (AC)        Never
System standby (DC)        After 5 mins
System hibernates (AC)     Never
System hibernates (DC)     After 20 mins
Processor Throttle (AC)    Not Supported
Processor Throttle (DC)    Not Supported

that will tell you what the current settings are. After that, you can set the power scheme by doing this:

psexec \\[workstation name] powercfg /setactive "[scheme name]"

It will exit with “error code 0″, but no worries. Just check your work using the query command above after your changes.