I need to get popup to change registry value when I do PC shutdown
I am trying to get popup to ask me on machine shutdown, do I want to change autologin registry change yes to change value 1 and no to change value 0. VB script is doing this job but when I run file on task scheduler or by local group policy, popup is not appearing. machine goes to shutdown/restart.
Script:
Set Shell = CreateObject("WScript.Shell")
Dim WshShell
Answer = MsgBox("Do You Want To" & vbNewLine & "change reg value on Your Computer?",vbYesNo,"Change:")
If Answer = vbYes Then
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\" _
& "CurrentVersion\Winlogon\AutoAdminLogon", "1", "REG_SZ"
Set WshShell=Nothing
Ending = 1
ElseIf Answer = vbNo Then
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\" _
& "CurrentVersion\Winlogon\AutoAdminLogon", "0", "REG_SZ"
Set WshShell=Nothing
If Stopping = vbYes Then
WScript.Quit 0
End If
End If
Solution 1:
Once shutdown has initiated, you can’t pause it to deal with an issue.
Create a batch file to prompt for the issue, deal with the issue, come back to the batch file via an exit code, and then issue shutdown /s
Another way (better for me) is to separate the two things: deal with your issue and then shut down separately.