Skip to content

Instantly share code, notes, and snippets.

View goffinf's full-sized avatar

Fraser Goffin goffinf

View GitHub Profile
@goffinf
goffinf / configure-wsl.ps1
Last active September 19, 2022 00:30
Powershell scripts to update the Windows hosts file to match the IP allocated to WSL2 and to create Inbound and optionally outbound firewall rules to allow externals clients to access ports exposed by WSL (e.g. k8s api). Create a desktop shortcut to configure-wsl.ps1
Param(
[string]$distro = "ADD-YOUR-DEFAULT-WLS2-DISTRO-NAME-HERE"
)
filter timestamp {"$(Get-Date -Format "yyyy/MM/dd HH:mm:ss") $_"}
$runningDirectory = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
Write-Output "`n"
Write-Output "Starting host file processing for WSL`n" | timestamp