Hi,
To generate a popup window for user confirmation when a shutdown or restart is initiated on a Windows 11 Pro workstation, you can use a combination of Group Policy settings and custom scripts. Here's how you can achieve this:
Step 1: Enable Shutdown Event Tracker
- Press
Win + R
, typegpedit.msc
, and press Enter to open the Group Policy Editor. - Navigate to Computer Configuration > Administrative Templates > System.
- Double-click on Display Shutdown Event Tracker.
- Set it to Enabled and choose Always.
- Click Apply and OK.
This will prompt users to provide a reason for shutdown or restart, but it won't hold the process until confirmation.
Step 2: Create a Custom Script for Confirmation
You can create a custom script that prompts the user for confirmation before proceeding with the shutdown or restart. Here's an example using PowerShell:
Create the PowerShell Script:
$result = [System.Windows.Forms.MessageBox]::Show('Do you want to proceed with Shutdown/Restart?', 'Confirmation', 'YesNo', 'Warning')
if ($result -eq 'Yes') {
Stop-Computer -Force
} else {
Write-Host 'Shutdown/Restart Aborted'
}
Save the Script: Save the script as ConfirmShutdown.ps1
.
Create a Scheduled Task:
- Open Task Scheduler and create a new task.
- Set the trigger to run the script when a shutdown or restart is initiated.
- In the Actions tab, set the action to start a program and point it to
powershell.exe
with the argument-File "C:\Path\To\ConfirmShutdown.ps1"
.
Step 3: Prevent Auto Restart After Windows Updates
To prevent automatic restarts after Windows updates, you can use Group Policy or Registry Editor:
Using Group Policy:
- Open Group Policy Editor (
gpedit.msc
). - Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Update.
- Double-click on No auto-restart with logged on users for scheduled automatic updates installations.
- Set it to Enabled and click Apply and OK.
Using Registry Editor:
- Open Registry Editor (
regedit
). - Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
. - Create a new DWORD (32-bit) Value named
NoAutoRebootWithLoggedOnUsers
and set its value to1
.
These steps should help you create a confirmation popup and prevent automatic restarts after updates.
If you need further assistance or run into any issues, feel free to ask! How's your team managing with the shared files so far?