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