0

Requirement: As part of deployment procedure I have to execute scripts on target servers.

Problems: I don't want to log-in into every server using RDP just to execute a script. Some servers are not part of the domain. IT doesn't allow using WinRM on non-domain servers.

Question: Considering the fact that I have an account on target server, with needed permissions, how to safely execute my scripts there without compromising security of the system?

Anil
  • 103
  • 3

2 Answers2

2

psexec to execute remote commands.

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

psexec \\computername -u user -p password ...

Username may need to be qualified with the computer name in front as in:

computername\username
ETL
  • 6,513
  • 1
  • 28
  • 48
  • I tried PsExec but couldn't make it work for non-domain machine :( – Anil Feb 03 '14 at 16:15
  • @Anil did you use the proper parameters? You may have to make the user qualified with the computer name in front like computer\user – ETL Feb 03 '14 at 16:19
  • This is what I do: `..\Tools\PsTools\PsExec.exe \\192.168.0.123 -u 192.168.0.123\MYUSER -p MYPASS cmd MD G:\Projects\DeploymentTempDir`, but I always get `Logon failure: unknown user name or bad password.` – Anil Feb 03 '14 at 16:42
  • Kludgy, but... can you create a local account on the Win7 workstation and run PSexec as that account? – Katherine Villyard Feb 03 '14 at 18:19
1

You can try the sysinternals PsExec, it can run scripts against a list of computers.

I am also a fan of SaltStack, the following in salt would run the 'ls' command on all minions:

salt '*' cmd.run 'ls'
Chris Montanaro
  • 830
  • 1
  • 7
  • 8