SHARE
TWEET

Disable Windows Script Host using Windows Batch Script

alternat0r Apr 20th, 2016 (edited) 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM -- A windows batch script used to disabled Windows Script Host on Windows registry.
  2. REM -- Feel free to use & distribute.
  3. REM -- Usage:
  4. REM     Save this script as whatever_name.bat and run as administrator.
  5.  
  6. @echo off
  7.  
  8. set add_hk=SOFTWARE\Microsoft\Windows Script Host\Settings
  9.  
  10. reg query "HKLM\%add_hk%" /v Enabled > nul 2> nul
  11.  
  12. if %errorlevel% equ 0 (
  13.     echo [+] Windows Script Host already disabled at HKLM. Skipped.
  14. ) else (
  15.     reg add "HKLM\%add_hk%" /v Enabled /t REG_DWORD /d 0 > nul 2> nul
  16.     if ERRORLEVEL 1 (
  17.         echo [-] ERROR: Access denied. Check your permission.
  18.     ) else (
  19.         echo [+] WSH successfully disabled at HKLM.
  20.     )
  21. )
  22.  
  23. reg query "HKCU\%add_hk%" /v Enabled > nul 2> nul
  24.  
  25. if %errorlevel% equ 0 (
  26.     echo [+] Windows Script Host already disabled HKCU. Skipped.
  27. ) else (
  28.     reg add "HKCU\%add_hk%" /v Enabled /t REG_DWORD /d 0 > nul 2> nul
  29.     if ERRORLEVEL 1 (
  30.         echo [-] ERROR: Access denied. Check your permission.
  31.     ) else (
  32.         echo [+] WSH successfully disabled at HKCU.
  33.     )
  34. )
  35. echo [+] FINISHED!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top