Solved

psexec using which login?

Posted on 2011-03-16
6
620 Views
Last Modified: 2012-05-11
Windows 2008

I use the following to deploy code to my production environment.
user, password, nas_server, instance are all variables.

   start c:\windows\psexec -s \\%%a -u %user% -p %password% /c "\\%nas_server%\nas\deploy\remotedeployscript.bat" %instance% %nas_server%

This works.  However, it will try to use my local login before it uses what is in my script.

Example.
I log into my computer as COMPANY\bob.   My script uses, PRODUCTION\automate.  psexec will try to login to the remote server as COMPANY\bob before trying PRODUCTION\automate.  COMPANY\bob doesn't exist on the remote computer.

Is there something wrong with my psexec switches?
0
Comment
Question by:md168
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:endege
ID: 35154702
By default, the process you execute on the remote system impersonates the account from which you run PsExec on the local system.

If you start a cmd with PRODUCTION\automate credentials it should work.
0
 
LVL 17

Expert Comment

by:Sikhumbuzo Ntsada
ID: 35154846
What if you specify a username to use say the domain administrator username?
0
 
LVL 1

Expert Comment

by:endege
ID: 35156672
He already specified the username and password with -u %user% -p %password% but that still tries to connect to the remote computer with the credentials he is logged in.

Starting psexec under different credentials will force it to run under those credentials
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:md168
ID: 35159197
endege:

The local server isn't on the remote PRODUCTION domain.  Also, how do I start a cmd with the automate account? . I only know how to run as administrator.   I guess I could create a local automate account with the same password as the remote automate account
0
 
LVL 1

Accepted Solution

by:
endege earned 500 total points
ID: 35163250
Go to C:\Windows\system32 (your windows dir might be WINNT or something else) and find cmd.exe, Right Click and select Run As, this way you can run the command prompt as a different user. Everything you do inside that cmd will run with the credentials you input at the Run As.

You could also run cmd from Start->Run with this command:

runas /user:domain\user cmd

Open in new window


After you run the command it will prompt you for your password.
0
 

Author Comment

by:md168
ID: 35288464
The runas still failed.  I'll try to play with this over the weekend.  
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

To effectively work with Diskpart on a Server Core, it is necessary to write some small batch script's, because you can't execute diskpart in a remote powershell session. To get startet, place the Diskpart batch script's into a share on your loca…
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now