Skip to content

Instantly share code, notes, and snippets.

@mzaglia
Created May 1, 2021 13:42
Show Gist options
  • Save mzaglia/164d9e00663be454a52cabc6c2a28f6a to your computer and use it in GitHub Desktop.
Save mzaglia/164d9e00663be454a52cabc6c2a28f6a to your computer and use it in GitHub Desktop.
WSL2 No internet
echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
{$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
| Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
{$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
| Enable-NetAdapter -Confirm:$False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment