Windows
NextDNS Blocker fully supports Windows, using Task Scheduler for automatic syncing.
Installation
Section titled “Installation”PowerShell Installer (Recommended)
Section titled “PowerShell Installer (Recommended)”# Download and run installerirm https://raw.githubusercontent.com/aristeoibarra/nextdns-blocker/main/install.ps1 | iexThe installer:
- Checks for Python
- Installs nextdns-blocker via pip
- Runs the setup wizard
- Configures Task Scheduler
pip install nextdns-blockerFrom Source
Section titled “From Source”git clone https://github.com/aristeoibarra/nextdns-blocker.gitcd nextdns-blockerpip install -e .# Initialize configurationnextdns-blocker init
# Configure domainsnextdns-blocker config edit
# Install watchdognextdns-blocker watchdog installTask Scheduler Integration
Section titled “Task Scheduler Integration”How It Works
Section titled “How It Works”NextDNS Blocker creates scheduled tasks:
| Task | Purpose | Interval |
|---|---|---|
NextDNS-Blocker-Sync | Run sync | Every 2 minutes |
NextDNS-Blocker-Watchdog | Self-heal | Every 5 minutes |
Viewing Tasks
Section titled “Viewing Tasks”# Command lineschtasks /query /tn "NextDNS-Blocker-Sync"schtasks /query /tn "NextDNS-Blocker-Watchdog"
# GUItaskschd.mscManaging Tasks
Section titled “Managing Tasks”# Check status via CLInextdns-blocker watchdog status
# Run task manuallyschtasks /run /tn "NextDNS-Blocker-Sync"
# Delete task manually (if needed)schtasks /delete /tn "NextDNS-Blocker-Sync" /fFile Locations
Section titled “File Locations”| Component | Path |
|---|---|
| Config | %APPDATA%\nextdns-blocker\config.json |
| Environment | %APPDATA%\nextdns-blocker\.env |
| Logs | %LOCALAPPDATA%\nextdns-blocker\logs\ |
| State | %LOCALAPPDATA%\nextdns-blocker\ |
Viewing Paths
Section titled “Viewing Paths”# Config directoryexplorer $env:APPDATA\nextdns-blocker
# Data directoryexplorer $env:LOCALAPPDATA\nextdns-blockerTimezone Detection
Section titled “Timezone Detection”Windows timezone is detected via:
tzutil /g# Returns: Eastern Standard TimeMapped to IANA format (e.g., America/New_York).
PowerShell Notes
Section titled “PowerShell Notes”Execution Policy
Section titled “Execution Policy”If scripts are blocked:
# Check current policyGet-ExecutionPolicy
# Allow scripts for current userSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserRunning Commands
Section titled “Running Commands”# Standard executionnextdns-blocker status
# If not in PATHpython -m nextdns_blocker statusPath Configuration
Section titled “Path Configuration”Adding to PATH
Section titled “Adding to PATH”If nextdns-blocker isn’t found:
# Find installation locationpip show nextdns-blocker
# Common locations:# %USERPROFILE%\AppData\Local\Programs\Python\Python311\Scripts# %USERPROFILE%\AppData\Roaming\Python\Python311\Scripts
# Add to PATH (PowerShell)$env:Path += ";$env:USERPROFILE\AppData\Local\Programs\Python\Python311\Scripts"
# Permanent (User Environment Variables)# System Properties → Advanced → Environment Variables → Path → EditDNS Cache
Section titled “DNS Cache”Flush Windows DNS cache:
ipconfig /flushdnsViewing Logs
Section titled “Viewing Logs”# Application logGet-Content "$env:LOCALAPPDATA\nextdns-blocker\logs\app.log" -Tail 50
# Sync logGet-Content "$env:LOCALAPPDATA\nextdns-blocker\logs\sync.log" -Tail 50
# Follow logsGet-Content "$env:LOCALAPPDATA\nextdns-blocker\logs\app.log" -WaitTroubleshooting
Section titled “Troubleshooting”Task Scheduler Not Running
Section titled “Task Scheduler Not Running”# Check Task Scheduler serviceGet-Service Schedule
# Start if stoppedStart-Service Schedule
# Check task statusschtasks /query /tn "NextDNS-Blocker-Sync" /vCommand Not Found
Section titled “Command Not Found”# Check if Python is in PATHpython --version
# Try running via Pythonpython -m nextdns_blocker status
# Find pip installationpip show nextdns-blocker | Select-String LocationPaths with Spaces
Section titled “Paths with Spaces”Windows usernames with spaces are handled automatically. If issues occur:
# Check for special characters in username$env:USERNAME
# Avoid characters: < > | & " 'Access Denied Errors
Section titled “Access Denied Errors”Run PowerShell as Administrator for initial setup:
- Right-click PowerShell
- Select “Run as administrator”
- Run
nextdns-blocker watchdog install
Python Not Found
Section titled “Python Not Found”- Download from python.org
- During install, check “Add Python to PATH”
- Restart PowerShell
Tasks Disappearing
Section titled “Tasks Disappearing”If scheduled tasks keep disappearing:
- Check antivirus software
- Check Group Policy restrictions
- Ensure Task Scheduler service is running
The watchdog task should restore the sync task automatically.
Windows Defender
Section titled “Windows Defender”If blocked by Windows Defender:
- Open Windows Security
- Go to Virus & threat protection
- Manage settings → Exclusions
- Add exclusion for:
%APPDATA%\nextdns-blocker\%LOCALAPPDATA%\nextdns-blocker\- Python installation directory
File Permissions
Section titled “File Permissions”Windows uses ACLs instead of Unix permissions:
- Config files are created with user-only access
- No special chmod needed
- Check file properties for permissions
Uninstalling
Section titled “Uninstalling”# Remove scheduled tasksnextdns-blocker watchdog uninstall
# Or manuallyschtasks /delete /tn "NextDNS-Blocker-Sync" /fschtasks /delete /tn "NextDNS-Blocker-Watchdog" /f
# Remove packagepip uninstall nextdns-blocker
# Remove configurationRemove-Item -Recurse "$env:APPDATA\nextdns-blocker"
# Remove dataRemove-Item -Recurse "$env:LOCALAPPDATA\nextdns-blocker"Running at Startup
Section titled “Running at Startup”Task Scheduler tasks run when you log in. For service-level operation (before login), you’d need:
- Create a Windows Service wrapper
- Use NSSM (Non-Sucking Service Manager)
- Or accept user-session-only operation
For most use cases, user-session operation is sufficient.