Cross-platform ad/malware blocking via the system hosts file.
Part of the myTech.Today PowerShell toolkit.
- Cross-Platform — Windows, macOS, and Linux
- Ad & Malware Blocking — Downloads rules from someonewhocares.org
- Smart Merging — Preserves your custom host entries
- Automatic Backups — Timestamped backups before every change (max 10 retained)
- DNS Cache Flush — Platform-specific flush after update
- Restore — Roll back to any previous backup
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
# Windows: Run as Administrator | macOS/Linux: sudo pwsh
.\hosts.ps1.\hosts.ps1 # Update hosts file
.\hosts.ps1 -WhatIf # Preview changes
.\hosts.ps1 -Force # Skip prompts
.\hosts.ps1 -BackupOnly # Backup only
.\hosts.ps1 -RestoreBackup # Restore latest backup
.\hosts.ps1 -SkipDNSFlush # Update without DNS flush| Parameter | Type | Description |
|---|---|---|
-BackupOnly |
Switch | Backup current hosts file without updating |
-RestoreBackup |
Switch | Restore from most recent backup |
-BackupPath |
String | Specific backup file to restore |
-SkipDNSFlush |
Switch | Skip DNS cache flush |
-Force |
Switch | Skip confirmation prompts |
-WhatIf |
Switch | Preview without applying |
- PowerShell 7.0+ (Core), elevated privileges, internet connection
| Platform | Hosts File | Backups | Logs |
|---|---|---|---|
| Windows | C:\Windows\System32\drivers\etc\hosts |
%USERPROFILE%\myTech.Today\hosts\backups\ |
%USERPROFILE%\myTech.Today\logs\hosts.YYYY-MM.md |
| macOS/Linux | /etc/hosts |
~/myTech.Today/hosts/backups/ |
~/myTech.Today/logs/hosts.YYYY-MM.md |
Safe. Secure. Support. Solutions. — Midwest IT services including Managed IT, Cyber Security, Cloud Solutions, AI & Automation, and PowerShell tooling.
📧 sales@mytech.today · 🌐 mytech.today · 💻 @mytech-today-now
© 2025 myTech.Today. All rights reserved.