Skip to content

mytech-today-now/hosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hosts File Manager

Cross-platform ad/malware blocking via the system hosts file.

Part of the myTech.Today PowerShell toolkit.

Features

  • 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

Quick Start

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

# Windows: Run as Administrator | macOS/Linux: sudo pwsh
.\hosts.ps1

Usage

.\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

Parameters

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

Requirements

  • PowerShell 7.0+ (Core), elevated privileges, internet connection

File Locations

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

About myTech.Today

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.

About

A cross-platform PowerShell tool for managing your system hosts file. Automatically downloads and merges ad-blocking + malware-blocking rules from someonewhocares.org while safely preserving your custom entries. Includes backups, DNS cache flushing, and WhatIf support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors