Linux Subsystem

Enable the Windows Subsystem for Linux

From Powershell:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Restart after install

Download a Linux distribution

Windows server doesn't have the windows store, so you'll have to do this manually. Link here:

Extract and install a Linux distribution

Extract the <distro>.appx package contents, using PowerShell:

Rename-Item .\Debian.appx .\

Expand-Archive .\ .\Debian

Move the folder to the location where you want the linux distro to live, then from powershell run the exe from the folder. For example: Debian.exe, or ubuntu.exe

Note: This partition must be NTFS not ReFS

You should then see a prompt:

"Installing, this may take a few minutes..."

Once it's ready, you'll be prompted to create a UNIX username & password:

Add distro to path variable:

$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")

[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")

Update and install linux software:

When logged into the distro

sudo su -

apt-get update && apt-get upgrade

apt-get install openssh-client vim zsh

After Linux Setup: Rsync

Setting Up Automatic Login over SSH with Passwordless Public/Private Key Authentication:


It is going to ask you for a series of inputs including where to save it & to password protect the key. If you have a directory where you want the files you can put that in or just hit enter for the default .ssh directory. For password protection DO NOT PUT ONE IN. Leave the field empty and just hit enter. A passwordless key pair will be generated:

Once this is done we need to put the public key on our server. The command below will have to be edited to suit your use case but will follow this structure:

ssh-copy-id -i .ssh/ root@

With this passwordless public/private key authentication is configured and you'll be given the following prompt:

You can now log into the remote server without supplying a password.

Create the Rsync Script

Create a script on your system that looks something similar to:


# -------------- system commands used by this script -----------------








# -------------- file locations --------------------------------------





# -------------- file server location --------------------------------



# --------------------------------------------------------------------

# make sure we're running as root

#if (( `$ID -u` != 0 )); then \

#$ECHO "Sorry, must be root. Exiting..."; \

#exit; \


$RSYNC -avzh -e 'ssh -p 22' --delete --delete-excluded --exclude-from=$EXCLUDES \


You can use a command similar to this to this in the Task Scheduler to launch the script

-cmd /C wsl sh /backup/bin/