1
I'm having to install Windows updates on multiple stand alone systems. I have my update_script.bat script to run, but as it loops through installing each update I am prompted by UAC controls for my credentials. So I found a command line option to turn off UAC.
@echo off
echo Disabling UAC controls...
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
shutdown /l /f
This way when I pass my scripts out to my subordinate admins, they can quickly run the first script; it'll automatically log them off then they can execute the second script (update_script.bat) file, but the problem I am having is when I test the first script to turn off UAC, the command window stops at:
Disabling UAC controls...
The operation completed successfully.
c:\updates>
instead of completing and forcefully logging the user off.
How do I get the system/script to force log off after I disable UAC controls?
Why
cmd /k
? Can't you run reg.exe on its own? – Thomas Weller – 2015-09-30T19:01:32.330Sorry. I'm not a script guru. I pulled that command from another forum - 3rd post from the bottom: http://superuser.com/questions/227860/how-to-toggling-uac-on-off-quickly-eg-using-command-line-in-windows-7
And you are probably right. I probably can.