How to Stop Malicious Scripts from Running on Your Windows PC

Menzi Sumile

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:

  1. Press Windows + R, type regedit, and hit Enter.
  2. Navigate to:
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings
  3. If there’s no “Settings” key, right-click on Windows Script Host, select New > Key, and name it Settings.
  4. Inside Settings, right-click > New > DWORD (32-bit) Value and name it Enabled.
  5. Double-click Enabled, set the value to 0, and click OK.
  6. 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:

  1. Open Windows Security from Start Menu.
  2. Click App & browser control.
  3. Scroll to Reputation-based protection and click Settings.
  4. 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:

  1. Press Windows + R, type gpedit.msc, and press Enter.
  2. Navigate to:
    User Configuration > Administrative Templates > System
  3. Double-click Don’t run specified Windows applications.
  4. Set it to Enabled, then click Show…
  5. Add powershell.exe and powershell_ise.exe.
  6. Click OK and apply the changes.

4. Update Windows and Security Definitions Regularly

Microsoft frequently patches vulnerabilities that malicious scripts exploit.

Steps:

  1. Go to Settings > Windows Update.
  2. Click Check for updates.
  3. 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:

  1. Go to Settings > Cookies and site permissions.
  2. Under JavaScript, choose Block on specific sites or toggle off entirely (not recommended for all sites).

For Chrome:

  1. Go to Settings > Privacy and security > Site Settings.
  2. 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.

This Article Covers:
Was this article helpful?
About the author
Menzi Sumile
About the author | Menzi Sumile
Menzi is a skilled content writer with a passion for technology and cybersecurity, creating insightful and engaging pieces that resonate with readers.

These also might be interesting for you

Computer Slow After RAM Upgrade: 4 Quick Fixes
Fix Your Slow Computer After Windows 11 Update
How Hackers Exploit Windows 11 Recall Feature