How to Stop Malicious Scripts from Running on Your Windows PC
Malicious scripts can silently run in the background, steal your data, corrupt files, or even give remote attackers control over your Windows device. These scripts are often hidden in websites, email attachments, software cracks, or pirated tools. If left unchecked, they can bypass traditional defenses and cause serious harm to your privacy, performance, and security.
If you’re noticing suspicious pop-ups, unexplained crashes, or your system running slower than usual, there’s a good chance that malicious scripts might be to blame. Let’s break down how to prevent these dangerous scripts from executing on your Windows 10 or 11 PC.
What Are Malicious Scripts and How Do They Work?
Malicious scripts are pieces of code, often written in JavaScript, PowerShell, VBScript, or batch files, designed to perform harmful actions without your permission. These scripts can:
- Download malware
- Change system settings
- Steal login credentials
- Execute ransomware
- Create hidden backdoors for attackers
They often exploit legitimate scripting environments in Windows, such as Windows Script Host (WSH) or PowerShell, which are powerful but can be dangerous if misused.
How to Stop Malicious Scripts from Running on Windows 10/11?
Here’s a detailed breakdown of actionable steps you can take:
1. Disable Windows Script Host (WSH)
Windows Script Host enables scripts, such as .vbs and .js, to run on your system. Disabling it can block script-based attacks.

Steps:
- Press Windows + R, type regedit, and hit Enter.
- Navigate to:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings - If there’s no “Settings” key, right-click on Windows Script Host, select New > Key, and name it Settings.
- Inside Settings, right-click > New > DWORD (32-bit) Value and name it Enabled.
- Double-click Enabled, set the value to 0, and click OK.
- Restart your PC.
To re-enable it in the future, change the value back to 1.
2. Use Windows Defender to Block Potentially Unwanted Applications (PUAs)
PUAs often include scripts that run silently.
Steps:
- Open Windows Security from Start Menu.
- Click App & browser control.
- Scroll to Reputation-based protection and click Settings.
- Enable both Block apps and Block downloads under Potentially Unwanted App blocking.
3. Restrict PowerShell and Script Execution via Group Policy
PowerShell is a powerful scripting tool. Lock it down to reduce risk.
Steps for Windows Pro or Enterprise:
- Press Windows + R, type gpedit.msc, and press Enter.
- Navigate to:
User Configuration > Administrative Templates > System - Double-click Don’t run specified Windows applications.
- Set it to Enabled, then click Show…
- Add powershell.exe and powershell_ise.exe.
- Click OK and apply the changes.
4. Update Windows and Security Definitions Regularly

Microsoft frequently patches vulnerabilities that malicious scripts exploit.
Steps:
- Go to Settings > Windows Update.
- Click Check for updates.
- Install available system and definition updates.
Always enable automatic updates if you’re not in the habit of checking manually.
5. Block Scripts via Browser Settings
Web-based scripts are common in phishing and adware attacks.
For Microsoft Edge:
- Go to Settings > Cookies and site permissions.
- Under JavaScript, choose Block on specific sites or toggle off entirely (not recommended for all sites).
For Chrome:
- Go to Settings > Privacy and security > Site Settings.
- Click JavaScript and configure permissions.
6. Take Advantage of Fortect to Help Stop Malicious Scripts and Optimize Your PC

Fortect is a powerful antivirus with real-time malware protection that goes beyond the capabilities of traditional Windows Defender.
With features like real-time malware protection that automatically detects malicious scripts, including PowerShell-based, JavaScript, and VBScript attacks, before they can harm your system. It scans your entire Windows PC for threats and:
- Removes malicious scripts and payloads
- Repairs corrupted or hijacked files
- Prevents script-based browser hijackers and adware
- Cleans junk files and crashes that may be script-triggered
But Fortect goes beyond antivirus:
- Optimizes Windows performance
- Fixes system files damaged by malicious scripts
- Cleans leftover script crash logs and junk
- Improves PC stability and startup speed
If you have Fortect Premium on your Windows PC, you also get Fortect Mobile Security for Android devices. It ensures:
- Real-time protection on the go
- Effortless script-blocking across platforms
- Seamless performance without interruptions
Stay secure on Android with Fortect, effortless, real-time protection designed for your mobile lifestyle.
Download and install Fortect now.
Signs Your Windows PC Is Running Malicious Scripts
Some symptoms may include:
- Slow system performance or sudden freezes
- Random browser redirects or ads popping up
- Files are getting encrypted or renamed unexpectedly
- Task Manager showing unknown processes
- Antivirus warnings or blocked actions
If you notice any of these signs, it’s time to take control before things escalate.
Conclusion
Stopping malicious scripts on your Windows PC takes a mix of smart system tweaks, regular updates, and real-time protection tools. Whether you’re a casual user or a power user, minimizing script-based threats helps keep your data, identity, and performance safe.
Manual methods work, but for total peace of mind and ongoing optimization, consider letting Fortect handle the heavy lifting for you.