Browsed by
Month: December 2016

Backup your Linux system via Powershell. WHAT?!

Backup your Linux system via Powershell. WHAT?!

I have a Linux. I have a Powershell….ahhh…

Sorry. Ahem.

Anyway. Yesterday I found out that Powershell can invoke SSH commands to Linux machines. And that’s bonkers, you can control your Linux system and leverage PS functionality together. Let’s see how you deal with it.

Adding SSH capabilities to Powershell

Microsoft once promised us to add OpenSSH to Powershell, we still didn’t get it. But whatever, we have an alternative called Posh-SSH. All you need is love the command:

After that connect to your Linux machine by creating a new SSH session:




Invoking SSH commands

Now as a proof of concept let’s try something simple.


Holy cow! It returned the hostname!

Using Veeam Agent for Linux

But I wouldn’t be a backup guy if I didn’t try to backup something with all this. So let’s try using some of the commands of Veeam Agent for Linux.


As you see, the output of shell is truncated, so if you care for the output, apply a little cheat and try again:


Now that is better, but the string is not readable, so let’s apply some formatting! (it soounds like it something obvious, but I killed a lot of time trying to make it look right, and the rules are weird)


Now that looks about right. Not perfect, but definitely readable.

Hey I just backed it up!

What’s next?

Well, I just discovered this stuff, so there’s a lot to do. You can combine Linux commands and powershell to create some powerfull scripts. I’m no scripting guy by any means, but even for me  that sounds pretty exciting.

As for you guys, I hope that opens some automation opportunities for you, just turn on your imagination.