Solved

psexec using which login?

Posted on 2011-03-16
6
628 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
OfficeMate Freezes on login or does not load after login credentials are input.
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…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

832 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