Sample code to create a PiHole server on WSL.
This is example code and not ready for production environments. Use at your own risk.
- Start the docker container on system startup and dynamically redirect DNS bindings of physical network adapters to the container.
- Testing, Testing, Testing
-
Windows Subsystem for Linux (WSL) needs to be installed
-
Docker needs to be installed.
-
Set the ExecutionPolicy of Powershell to
unrestricted
Set-Executionpolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
- Execute the setup script
Set-Location './PiHole-on-WSL' # use the proper path
# define a random password for the PiHole web interface
# DO NOT USE THIS EXAMPLE!
$password = ConvertTo-SecureString '&v!N5n!OSfB2#5H1';
# execute the script
. .\setup.ps1 -Password $password
- Set the ExecutionPolicy to the original setting
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned