Auto deploying a site after a successful Jenkins build

I found myself wanting to have a test site auto deploy once the tests on our continuous integration server had passed.
The reason for this is so that the new Selenium tests I wrote for the site would always be running against the latest version.

This meant configuring Jenkins (the relevant continuous integration software) to run a one line command for the project’s post build action.
Here’s the command:

psexec \\[Remote server’s IP address] -u mydomain/admin -p thisisapassword cmd /c “[Path to deployment script]”

You will need to install psexec onto the server that runs the above command. So in this case, the windows server that is hosting Jenkins.
See here for the files and where you should put them https://technet.microsoft.com/en-us/sysinternals/psexec.aspx?f=255&MSPPError=-2147217396
You do not need to install psexec on the server with the deployment script.

If you are also doing this for selenium tests, I recommend in the selenium test’s Jenkins project, adding a quiet period of a couple of minutes in order to give the deployment code some time to well, deploy. You’ll need to click the advanced settings button to see this hidden option though.