This repository contains two PowerShell scripts for securing and restoring your Windows 10/11 system by managing open ports, services, and IPv6 settings.
💻📜⚡ PowerShell Script ⚡📜💻
| 📝 Script | 📄 Description | ⚙️ Function |
|---|---|---|
💻📜⚡ Harden-Windows.ps1 |
Blocks dangerous ports and disables services | 🛡️ Harden your system |
💻📜⚡ Restore-WindowsDefaults.ps1 |
Restores default services, ports, and IPv6 | ♻️ Rollback if needed |
- ✅ Blocks commonly exposed ports (e.g.,
135,139,445,5040,49664–49669) - ✅ Disables unneeded Windows services like:
- Remote Registry
- Remote Desktop (RDP)
- SMB file sharing
- UPnP
- ☰ (Optional) Disables IPv6 (commented by default)
- Windows 11
- Administrator privileges
- Powershell 7.x.x
- PowerShell execution policy temporarily modified
Download the PowerShell(.ps1) files from Releases
1) Install Git
git clone https://github.com/Mr-DS-ML-85/Harden-Windows.git
</> Execute:
cd C:\Users\USERNAME\Downloads
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Y
.\Harden-Windows.ps1This script:
🔂 Re-enables all services disabled by the hardening script
🔂 Removes all firewall rules created to block ports
🔂 Restores IPv6 if it was disabled
Navigate to the folder containing the scripts, then:
</> Execute:
cd C:\Users\USERNAME\Downloads
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Y
.\Restore-WindowsDefaults.ps1✅️ Use only if you're not running SMB shares, RDP, or printers
🛠 Requires Administrator privileges
- Only on Windows 11
- Windows 10 Expires on October 14, 2025
- This project is open-source and available under the 📜 MIT License
- Contributors are welcome to contribute and make sure checking CONTRIBUTING.md