How to install Ubuntu on Windows 10 with PowerShell?

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?


Try this for Ubuntu:

https://docs.microsoft.com/en-us/windows/wsl/install-on-server

Installing apps with powershell:

https://social.technet.microsoft.com/Forums/windows/en-US/e5c5a26c-e8ba-439d-a0c0-074b475e0f1b/install-windows-store-apps-from-powershell?forum=w8itprogeneral

Install Windows Store App itself