Unattended service re-deployments on Windows Servers

Make your redeploys unattended, faster, and more stable!

If you are a Linuxer but you need to deal with Windows based infra, you probably hate how GUI everything is… Although I don’t totally dislike RDP sessions, they will never match the power and agility of a terminal…

Sick and tired of manually:

  • Stopping the Windows Service on the Windows Server

  • Replacing the WAR/EAR/ZIP/NPM/… file manually (and slowly)

  • Restarting the service on the server

  • Checking the logs in some crappy editor like Notepad++

  • And then, do what I actually was intended to do…

I rolled up my sleeves and put together a spell to avoid having to deal with it ever again!

Ingredients

Running it

It’s simple: you build the new version of your bundle, and then you redeploy it with the script, e.g.:

PS1> npm run build && powershell -ExecutionPolicy Bypass -File ".\RedDeploy.ps1" <Windows_Server_host> <Windows_Service_a

The magic

Let’s break the one-liner down:

  • Build your new bundle: If it is a Java project, re-compile and package your app to test your changes: $ npm run build

  • Execute the .\ReDeploy.ps1

That’s it!

Additionally, the file transfer on the terminal seems to be faster and more stable than dragging the file within an RDP session!

For any question, check the README.md of the script.

Updated on