Solved

psexec using which login?

Posted on 2011-03-16
6
635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
For anyone that has accidentally used newSID with Server 2008 R2 (like I did) and hasn't been able to get the server running again because you were unlucky (as I was) and had no backups - I was able to get things working by doing a Registry Hive rec…
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
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…

724 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