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?