Solved

psexec using which login?

Posted on 2011-03-16
6
631 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
NTP time source for DC 3 53
Measure time after installing Antivirus 8 59
Unable to hit site 2 30
Promote Server 2012 R2 on Server 2003 domain 13 25
Redirected folders in a windows domain can be quite useful for a number of reasons, one of them being that with redirected application data, you can give users more seamless experience when logging into different workstations.  For example, if a use…
A safe way to clean winsxs folder from your windows server 2008 R2 editions
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

726 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