Adding in WSL into Hyper-V VM in Windows Server

Default Windows OS doesn’t allow hyperV feature to be enabled in VM

Create nested Hyper-V

  1. Shut down the VM.
  2. In the host open Powershell with administrator rights.

    Set-VMprocessor ExposeVirtualizationExtension $true
    VMName

  3. Turn on VM.

Installation

  1. Open PowerShell with administrator rights

    Hyper-V is requirement for WSL installation
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

    Enable WSL
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  2. Windows server does not have Microsoft store, we will have to download the distribution files.
    https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions
  3. Extract the .appx package’s contents, using PowerShell:

Copy-Item .\Ubuntu.appx .\Ubuntu.zip
Expand-Archive .\Ubuntu.zip .\Ubuntu

Add-AppxPackage .\app_name.appx

Add your Linux distribution path to the Windows environment PATH
$userenv = System.Environment::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + ";C:\Users\Administrator\Ubuntu", "User")

You can now launch your distribution from any path by typing .exe. For example:
ubuntu.exe.

After launching the ubuntu.exe you might encounter Kernel error. WslRegisterDistribution failed with error: 0x800701bc,

link to package https://learn.microsoft.com/en-us/windows/wsl/install-manual

Reference

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

https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions

Setup Windows DFS

Go to Server Manager -> Add Roles and Features.
Select under file and storage service, check DFS Namespaces and DFS Replication, Click Install

Create New Namespace

Create DFS Folders linking to target folder

This will be the DFS shared folder

This is what it will look like in Server Manager

Second Server to replicate data

Install-WindowsFeature -name “FS-DFS-Replication” -IncludeManagementTools

Install-WindowsFeature -name “FS-DFS-Namespace” -IncludeManagementTools

Go to DFS management. Add Folder Target

\\Server02\folder_name

Set Primary Member, Topology Full mesh, Replicate continuously using the specified bandwidth

Source : https://www.nakivo.com/blog/configure-dfs-replication-for-windows-server/, https://msftwebcast.com/2020/01/install-and-configure-dfs-namespaces-in-windows-server-2019.html

MS HyperV 2019/2022 error when creating Virtual Switch

  1. Create NIC Teaming as per usual.
  1. Configuration NIC MS Network Adapter Multiplexor Driver as per usual
  2. Run POWERSHELL
New-VMSwitch -Name "{Name your new vSwitch here}" -NetAdapterName "{NIC Team name you created previously}" -AllowNetLbfoTeams $true -AllowManagementOS $true

This will create a NIC with IP configurations done.

Go the HyperV Management -> Virtual Switch Manager, add in VLAN ID.

Done