[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

psexec using which login?

Posted on 2011-03-16
6
Medium Priority
?
639 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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 

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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

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
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Suggested Courses

650 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