Overview
VBScript utilities for Windows system automation and configuration. These scripts are tested on Windows 7, 10, and 11 (x64).VBScript is a legacy scripting language still supported in modern Windows for backward compatibility. For new projects, consider using PowerShell instead.
Prerequisites
- Windows 7, 10, or 11 (x64)
- Administrator privileges (for most operations)
- Windows Script Host (WSH) enabled (enabled by default)
Available Scripts
Autorun Disable
Disable Windows AutoRun/AutoPlay functionality to enhance security. Download:- GUI Mode
- Command Line
- Administrator
- Download the script
- Right-click
autorun.vbs - Select “Open with” → “Microsoft Windows Based Script Host”
- Disables AutoRun for all drives
- Disables AutoPlay for removable media
- Registry-based configuration
- Improves security against USB-based attacks
- Prevents automatic execution of malware
Security Enhancement
Security Enhancement
Prevents automatic execution of programs when removable media (USB drives, CDs, DVDs) is inserted.Protection Against:
- USB-based malware
- Auto-executing viruses
- Unwanted program launches
- Social engineering attacks
Registry Modifications
Registry Modifications
The script modifies the following registry keys:Sets:
NoDriveTypeAutoRun= 255 (disable all drive types)NoAutorun= 1 (disable autorun)
Affected Devices
Affected Devices
Disables AutoRun/AutoPlay for:
- USB flash drives
- External hard drives
- CD/DVD drives
- Memory cards
- Network drives
Script Details
How VBScript Works on Windows
VBScript files (.vbs) are executed by Windows Script Host (WSH), which provides two execution environments:
- wscript.exe: GUI mode (default when double-clicking)
- cscript.exe: Console mode (for command-line usage)
Execution Methods
Security Considerations
Why Disable AutoRun?
AutoRun/AutoPlay was a common attack vector:- Malware Propagation: Infected USB drives could auto-execute malware
- Social Engineering: Attackers could disguise malware as legitimate autorun content
- Worm Spreading: Network worms used AutoRun to spread across systems
Microsoft has disabled AutoRun by default in Windows 7 and later for removable drives, but AutoPlay may still be enabled. This script ensures both are disabled.
Advanced Usage
Running at System Startup
- Task Scheduler
- Startup Folder
- Group Policy
Verifying AutoRun Status
Check if AutoRun is disabled:Reverting Changes
To re-enable AutoRun (not recommended):Alternatives to VBScript
For modern Windows automation, consider:PowerShell
Modern, powerful scripting language built into Windows
Batch Scripts
Simple command-line scripts for basic automation
Troubleshooting
Script Won't Run
Script Won't Run
Possible Causes:
- Windows Script Host disabled
- Antivirus blocking execution
- File association broken
Access Denied Errors
Access Denied Errors
Solution:
- Run Command Prompt as Administrator
- Use elevated privileges
Changes Not Taking Effect
Changes Not Taking Effect
Solution:
- Log off and log back in
- Restart Windows Explorer
- Reboot the system
Best Practices
- Code Review: Always review VBScript contents before execution
- Backup: Create system restore point before running system modification scripts
- Testing: Test scripts in virtual machines or test environments first
- Documentation: Keep notes of what scripts do and when they were run
- Updates: Check for script updates periodically
Additional Resources
Windows Script Host
Learn more about WSH and VBScript fundamentals
Registry Editor
Understanding Windows Registry for advanced configuration
Security Hardening
Windows security best practices and hardening guides
PowerShell Migration
Migrate from VBScript to modern PowerShell scripts