This collection contains scripts for Windows Defender control and comprehensive cache clearing on Windows 10/11.
Disabling Windows Defender will leave your system vulnerable to malware and viruses. Only use these scripts if you absolutely need to and understand the security risks involved.
- Disable/Enable Windows Defender completely
- Safe with confirmation prompts
- Proper error handling
- Easy batch file execution
- Complete Cache Clear: Remove all types of cache at once
- Selective Cache Clear: Choose specific cache types to clear
- Interactive Menu: User-friendly selection interface
- Real-time Status: See progress as scripts run
disable_windows_defender.ps1- PowerShell script to disable Windows Defenderenable_windows_defender.ps1- PowerShell script to re-enable Windows Defenderdisable_windows_defender.bat- Batch file wrapper for easy execution
clear_all_cache.bat- Batch script to clear all cache typesclear_all_cache.ps1- PowerShell script to clear all cache types (advanced)selective_cache_clear.ps1- Interactive menu to selectively clear specific cache types
- Right-click on
disable_windows_defender.bat - Select "Run as Administrator"
- Follow the prompts
- Right-click on PowerShell and select "Run as Administrator"
- Navigate to the script directory
- Run:
.\disable_windows_defender.ps1
Use the same methods with enable_windows_defender.ps1 or run:
.\enable_windows_defender.ps1- Right-click on
clear_all_cache.bat - Select "Run as Administrator"
- Follow the prompts
- Right-click on PowerShell and select "Run as Administrator"
- Navigate to the script directory
- Run:
.\clear_all_cache.ps1
- Right-click on PowerShell and select "Run as Administrator"
- Navigate to the script directory
- Run:
.\selective_cache_clear.ps1 - Choose which cache types to clear from the menu
- Disables real-time monitoring
- Disables IOAV protection
- Disables behavior monitoring
- Disables block at first sight
- Disables cloud protection
- Disables sample submission
- Re-enables all the above protections
- Sets cloud protection to "Advanced"
- Sets sample submission to "Send Safe Samples"
- Windows Update Cache
- DNS Cache
- Temporary Files (User & System)
- Browser Cache (Chrome, Firefox, Edge)
- Windows Store Cache
- System Cache (Prefetch, Event logs)
- User Profile Cache (Recent files, Thumbnails)
- Print Spooler Cache
- Font Cache
- Disk Cleanup (automatic)
- Interactive menu system
- Choose specific cache types to clear
- Real-time status updates
- Error handling for each operation
- Windows 10 or Windows 11
- Administrator privileges
- PowerShell execution policy that allows script execution
If you get errors:
- Make sure you're running as Administrator
- Check if Windows Defender is managed by Group Policy
- Try running PowerShell as Administrator and execute:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Remember to re-enable Windows Defender when you're done with your task. These scripts are for temporary use only.
- Performance Improvement: Clearing cache can free up disk space and improve system performance
- Troubleshooting: Helps resolve issues with Windows Update, browsers, and system components
- Privacy: Removes browsing history and temporary files
- Storage Space: Frees up significant disk space, especially after long periods of use
- Close all applications before running cache clearing scripts
- Restart your computer after clearing cache for best results
- Use selective clearing if you only need to clear specific cache types
- Run regularly to maintain optimal system performance
This project is open source and available under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
These scripts are provided as-is for educational and troubleshooting purposes. Use at your own risk. The authors are not responsible for any damage or data loss that may occur from using these scripts.
If you encounter any issues or have questions, please open an issue on GitHub.