Ever wondered how to remotely execute a command on a remote machine. Here is what I had to deal with, leading to my research and a subsequent discovery of this powerful utility. We have this ASP.Net project that was getting deployed to the various in-house environments using Hudson, a continuous deployment tool. There was this requirement that the web.config had to be encrypted. In our project configuration setup, the files from the build (CI) server will be deployed/coped to various environments, however the web.config cannot be pre-encrypted, rather it has to be encrypted in the hosting environment.
I have created a batch file that has to be executed on the deployed environment to be able to encrypt the web.config file. PSExec came to my rescue by being able to execute the batch file on the host environments from the continuous integration server. The account that is used to run Hudson should also have rights on the host machines to be able to run PSExec.
PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec’s most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems. [1]
psexec \\MACHINE_NAME c:\temp\encrypt.bat
I hope I made my point in showcasing a capability of this tool.
Reference:
1. PSExec – by Mark Russinovich



