Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save john-clark/4cddb67022e009b7464944483f8423d8 to your computer and use it in GitHub Desktop.
Save john-clark/4cddb67022e009b7464944483f8423d8 to your computer and use it in GitHub Desktop.
devs gonna dev
@echo off
net.exe session 1>NUL 2>NUL || (Echo This script requires elevated rights. & Exit /b 1)
set key=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
set val=ConsentPromptBehaviorAdmin
set new=0x0
set old=
echo 0 = Elevate without prompting
echo 1 = Prompt for credentials on the secure desktop
echo 2 = Prompt for consent on the secure desktop
echo 3 = Prompt for credentials
echo 4 = Prompt for consent
echo 5 = Prompt for consent for non-Windows binaries *DEFAULT*
for /F "skip=2 tokens=3" %%r in ('reg query %key% /v %val%') do set old=%%r
echo old=%old%
echo.
echo turning off prompt
reg add %key% /v %val% /d %new% /f
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment