To automatically update Windows Server 2019 and reboot, configure Group Policy (gpedit.msc)
to "Auto download and schedule the install" (Option 4), set a specific
time, and enable "No auto-restart with logged on users" to manage uptime. Alternatively, use
sconfig for quick command-line configuration or Action1 for automated patching.Steps to Automate Updates and Reboot (Group Policy):
- Open Policy Editor: Press
Win + R, typegpedit.msc, and hit Enter. - Navigate to:
Computer Configuration>Administrative Templates>Windows Components>Windows Update. - Configure Automatic Updates: Double-click "Configure Automatic Updates," set to Enabled, and select 4 - Auto download and schedule the install.
- Schedule Time: Set the install day and time (e.g., Every Sunday at 3:00 AM).
- Enable Auto-Reboot: In the same list, find and enable No auto-restart with logged on users (if you want to avoid abrupt reboots) or enable Always automatically restart at scheduled time for strict automation.
- Apply Policy: Open Command Prompt as Administrator and run
gpupdate /force.
Alternative Methods:
- sconfig: Run
sconfigin CMD, select option 5, and choose 'A' for Automatic. - Registry: Set
HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU>AUOptionsto4.
Key Considerations:
- Active Hours: Set active hours in Settings > Update & Security to prevent reboots during business hours.
- Active Directory: If domain-joined, use
gpmc.mscon the Domain Controller to apply these settings via Group Policy Object (GPO) to multiple servers. - Action1: A third-party, free-tier option for patching.
To create a group policy for all servers at once, create a new GPO in the Group Policy Management Console
(GPMC) and link it to the "Domain Controllers" Organizational Unit (OU)
or the root of the domain, ensuring it covers all server objects. For targeted application, use security filtering to apply the policy to a specific AD group containing all target servers.
Steps to Create and Apply a GPO to All Servers:
- Open Management Tools: On a domain controller, open
gpmc.mscvia the Start Menu or Run dialog (Windows + R). - Create GPO: Right-click Group Policy Objects and select New. Name it (e.g., "All Servers Policy").
- Edit Policy: Right-click the new GPO and select Edit to configure settings under Computer Configuration.
- Link to Domain Root (For All Servers): Right-click your domain name (e.g.,
contoso.com) and select Link an Existing GPO to apply to all computers, including servers. - Link to Domain Controllers (For DCs Only): Alternatively, right-click the "Domain Controllers" OU and link the GPO to only affect DC servers.
- Apply Security Filtering (Optional): To refine targeting, in the GPO's Scope tab, remove "Authenticated Users" and add a security group containing the desired servers.
- Update Policy: Run
gpupdate /forceon servers to apply immediately, or wait for the automatic refresh (roughly 90 minutes).
No comments:
Post a Comment
Note: only a member of this blog may post a comment.