JSI Tip 8324. How do I set the 'Internet Options / Advanced / Disable Script Debugging (...)' option in a script?


The Disable Script Debugging (...) options are NOT exposed in any Group Policy. I have scripted DSD.bat to set the option(s) into a logged on user's HKEY_CURRENT_USER hive.

The syntax for using DSD.bat is:

\[call\] DSD \[/I:Y|N\] \[/O:Y|N\] \[/B:Y|N\]

Where /I:Y|N is an optional switch that disables the script debugger (Y), or enables it (N).

In the future (Windows XP SP2), Windows will support Disable Script Debugging (Internet Explorer) and Disable Script Debugging (Other). When both options exist, the /O:Y|N switch will set the Disable Script Debugging (Other) value into the registry. The /B:Y|N switch will set both options.

NOTE: Currently, only the Disable Script Debugger Value Name exists in the registry. In Windows XP SP2, the DisableScriptDebuggerIE Value Name will be added. For compatibility, the \[/I:Y|N\] switch will set the Disable Script Debugger Value Name if the DisableScriptDebuggerIE Value Name does not exist.

DSD.bat contains:

@echo off
setlocal
If not \{%3\}

\{\} goto err1 if \{%1\}

\{\} goto err2 :loop if exist "%TEMP%\DSD.reg" del /q "%TEMP%\DSD.reg" if \{%1\}==\{\} goto finish set switch=%1 shift if /i "%switch:~3,1%" EQU "Y" goto :OK if /i "%switch:~3,1%" NEQ "N" goto :err2 :OK if /i "%switch:~0,3%" EQU "/I:" goto IE if /i "%switch:~0,3%" EQU "/O:" goto Other if /i "%switch:~0,3%" EQU "/B:" goto Both goto err2 :IE set DSDIE=N regedit /a "%TEMP%\DSD.reg" "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" for /f "Tokens=*" %%a in ('findstr /I /L /C:"DisableScriptDebuggerIE" "%TEMP%\DSD.reg"') do ( set DSDIE=Y ) del /q "%TEMP%\DSD.reg" if "%DSDIE%" EQU "N" goto :Other call :outkey @echo "DisableScriptDebuggerIE"="%DYN%">>"%TEMP%\DSD.reg" goto setvalue :Other call :outkey @echo "Disable Script Debugger"="%DYN%">>"%TEMP%\DSD.reg" goto setvalue :Both call :outkey @echo "Disable Script Debugger"="%DYN%">>"%TEMP%\DSD.reg" @echo "DisableScriptDebuggerIE"="%DYN%">>"%TEMP%\DSD.reg" goto setvalue :outkey set DYN=no if /i "%switch:~3,1%" EQU "Y" set DYN=yes ( @echo REGEDIT4 @echo @echo \[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\] ) >"%TEMP%\DSD.reg" goto :EOF :setvalue regedit /s "%TEMP%\DSD.reg" del /q "%TEMP%\DSD.reg" goto :loop :err1 @echo Syntax: \[call\] DSD \[/I:Y^|N\] \[/O:Y^|N\] \[/B:Y^|N\] - Too many switches. goto :finish :err2 @echo Syntax: \[call\] DSD \[/I:Y^|N\] \[/O:Y^|N\] \[/B:Y^|N\] :finish endlocal



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish