Removing a Windows Script Host trojan safely
Windows Script Host (WSH) is a legitimate Windows feature that runs JavaScript, VBScript and related files through wscript.exe or cscript.exe. Malware abuses this trusted component to hide downloads, start command processors, or maintain access without displaying a normal application window.
Removing a trojan that uses Windows Script Host to download additional payloads requires more than deleting one suspicious file. Cleanup must interrupt network access, remove scheduled tasks or startup entries, eliminate downloaded executables, and secure accounts. Using a separate, known-clean computer for instructions and password changes lowers the chance of reinfection.
Spot the signs before cleanup
Check Task Manager for wscript.exe or cscript.exe and review Microsoft Defender’s Protection History for related alerts. A suspicious execution often begins immediately after a downloaded file opens, uses a script path in a temporary folder, and is followed by network activity. Confirm that any executable named wscript.exe is running from C:\Windows\System32, rather than a copied file in another directory.
| Observation |
Normal use |
Trojan warning sign |
| Script process |
An administrator runs an approved script |
It starts after a download and runs without a visible console |
| Script location |
A known project or managed deployment folder |
Random name in Temp, AppData, or Downloads with .js, .vbs, or .jse |
| Persistence |
A task belongs to installed software |
A recent task, Run key, or service points to a user-writable script path |
| Child activity |
The script performs a defined local action |
It launches PowerShell, certutil, BITS transfer, or another downloader |
No single sign proves an infection because software deployment tools and administrators also use WSH. Correlate process timing with Defender alerts, browser download history, and newly created files. A sudden chain of script, command shell, and network activity is a strong reason to isolate the machine.
Cut off downloads and run clean scans
First, disconnect the suspect computer from the internet: switch off Wi-Fi and unplug Ethernet. In Sydney, Melbourne and Brisbane, home and small-business networks commonly combine Windows devices with NBN, 4G or 5G routers. Disconnecting only the browser is insufficient because scripts can still reach malicious servers through other applications. Leave the machine powered on if practical and use another device for the remaining steps.
Copy ordinary documents to clean storage, but do not copy .exe, .js, .vbs, .jse, .hta, .cmd, .bat or .ps1 files from the affected profile. Do not open them to check them. Keep the original device isolated because an archive can preserve a malicious payload.
In Windows Security, update Microsoft Defender, choose Scan options, run Microsoft Defender Offline scan, and then perform a normal full scan. Quarantine confirmed detections. If Defender cannot start or reports that protection has been changed, use a clean, trusted device to prepare bootable rescue media from a reputable security vendor, or seek help from a qualified local IT professional. Note any persistence names that reappear.
Remove startup entries and payload files
Use Microsoft’s Sysinternals Autoruns as administrator and review its Logon, Scheduled Tasks, Services and WMI tabs. Look for recent or unsigned entries whose commands point to Temp, AppData, Downloads, or an unfamiliar script name. Disable an entry first, apply the change and verify the result. Do not remove recognisable Microsoft or installed-software components simply because Autoruns colours their status.
Also inspect Task Scheduler, the Startup folders and the Windows Startup apps list. The Get-CimInstance Win32_StartupCommand PowerShell query provides a read-only view of configured startup commands. For Run and RunOnce keys under HKCU and HKLM, check both standard and 32-bit registry views, and remove only values whose file path is confirmed as malicious.
Then quarantine the parent script and every payload it downloaded. Search Temp, AppData, ProgramData and the user’s Downloads folder for the script extensions listed earlier, using Defender’s detections to avoid deleting legitimate administration files. Empty the Recycle Bin, reboot, and repeat both offline and full scans. If a script or task returns, the original persistence mechanism has not yet been removed.
Reset browsers, routers, and exposed accounts
Browser hijackers can work alongside a script trojan by forcing searches, opening pages or displaying fake warnings. The fake system alerts guide explains how to remove deceptive pop-ups and notifications. Review browser extensions, notification permissions, homepage and search-engine settings, then clear cached data. Remove anything tied to the infection.
Check the local router or NBN gateway for unknown devices, changed DNS settings, altered administrator credentials or unnecessary UPnP. Update its firmware, change its management password from a clean device, and restore DNS settings supplied by the internet service provider. Coordinate with the provider for managed equipment; a factory reset is a last step because it removes the local network configuration.
After cleanup, change the email password first, followed by the password manager, Microsoft account and other important services. Enable multi-factor authentication wherever available. If a session involving CBA, Westpac, ANZ, NAB or Bendigo Bank was accessed, contact the bank promptly, freeze affected cards where advised and request a security review.
Reduce the chance of another infection
Keep Windows, Defender and browsers on automatic update schedules, enable Defender Tamper Protection, and avoid running emailed or messaging-app scripts. Mark a downloaded script as unblocked only after confirming its publisher and purpose; an .hta file, for example, can run code outside a normal browser sandbox. Business systems can enforce stricter script controls with WDAC or AppLocker, while personal users should not disable WSH globally unless an IT administrator manages the restriction.
Microsoft Defender is already included with Windows, while commercial antivirus products in the Australian retail market often have annual subscriptions priced in Australian dollars and automatic renewal. Compare renewal terms and privacy settings before buying an extra package. ACCC Scamwatch and the Australian Signals Directorate’s Cyber Security Centre guidance are useful Australian references. Everyday parcel tracking and toll-payment habits also make impersonations of Australia Post, Toll or the Australian Taxation Office especially convincing.
Regular security news updates can expose new download chains and changing persistence methods. Continue offline scans for several weeks, keep automatic backups and test recovery files from another device. When the script, payloads, persistence entries and detection records remain absent after clean scans, the computer can normally return to service with close monitoring.