Now that we’ve successfully set up our Windows box, the most pressing question that people ask themselves would be: How do I administer my box without SSH, as we started from a bare box without installing a SSH daemon beforehand?

The answer to that would be WinRS (Windows Remote Shell), the Windows equivalent of SSH. Assuming that you’ve followed the packaging and setup instructions for your Windows box previously, WinRS and it’s dependency, WinRM (Windows Remote Management) should already be setup correctly.

In order to administer our Windows box, all we need to do is to simply  replace our well loved

vagrant ssh

with

winrs -r:http://localhost:15985 -u:vagrant cmd

which will launch a remote PowerShell terminal and log you in. And there you have it, command line administration of a Windows box!

One current limitation of using WinRS is that due to the way it pipes standard output, we can’t run console based text editors  such as nano, pico, vim, etc if we want to edit files in the box. As a workaround, I’ve placed files inside a shared Vagrant folder and edited them on the host, and also edited code on the host, pushed it to GitHub and pulled it on the guest. None of these solutions are particularly elegant, but command line administration of Windows boxes still has some ways to go before it catches up to the *nix world.

Now, to install Jenkins, instead of running apt-get install jenkins (depending on your preferred version of Linux), you can simply run

cinst jenkins

With a combination of WinRS, Chocolatey and Puppet, the next time someone doubts that you can automatically provision a Windows box and administer it from the command line, you can now show them how it’s done .