Linux – How to install Ubuntu on Windows 10 with PowerShell

powershellwindows-storewindows-subsystem-for-linux

With the last update of Windows 10 (Fall Creator's Update), we can install Ubuntu on Windows, which is a Windows Store application. We can enable Windows Subsystem for Linux (WSL) via PowerShell with a command:

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

With the spirit of Dotfiles, I would like to install Ubuntu on Windows with PowerShell. At first hand, I thought that it could be possible with the Appx Module in PowerShell. With some experiments, it seems to apply on already installed applications.

So the question is: how to install Ubuntu on Windows 10 with PowerShell, or more generally, how to install an app from Windows Store with PowerShell?

Related Question