Gpupdate Powershell May 2026

Get-GPResultantSetOfPolicy -ReportType Html -Path "C:\Reports\RSOP.html"

Here’s a complete guide to using gpupdate with PowerShell, including syntax, common parameters, examples, and related cmdlets. gpupdate refreshes local and Active Directory-based Group Policy settings. It replaces the legacy secedit /refreshpolicy . Syntax (Command Prompt) gpupdate [/target:computer] [/force] [/wait:<seconds>] [/logoff] [/boot] [/sync] [/?] Run from PowerShell # Directly call gpupdate.exe gpupdate /force Or using Start-Process Start-Process gpupdate -ArgumentList "/force" -NoNewWindow -Wait 2. Useful gpupdate Parameters | Parameter | Description | |-----------|-------------| | /target:computer\ | Updates only computer or user policy. | | /force | Reapplies all policy settings (ignores fast-logon optimization). | | /wait:<seconds> | Waits for policy processing to finish (max seconds). | | /logoff | Logs off after update (for user-targeted settings). | | /boot | Restarts after update (for computer-targeted settings). | | /sync | Synchronous foreground processing (waits for network). | 3. PowerShell Wrapper Function for gpupdate Create reusable logic with error handling and logging. gpupdate powershell

$argString = $arguments -join " " Write-Verbose "Running: gpupdate $argString" | | /wait:&lt;seconds&gt; | Waits for policy processing

function Invoke-GPUpdate [CmdletBinding()] param ( [ValidateSet("Computer", "User", "Both")] [string]$Target = "Both", [switch]$Force, [switch]$Logoff, [switch]$Boot, [int]$WaitSeconds = 600, [switch]$Sync ) $arguments = @() if ($Target -ne "Both") $arguments += "/target:$($Target.ToLower())" if ($Force) $arguments += "/force" if ($Logoff) $arguments += "/logoff" if ($Boot) $arguments += "/boot" if ($Sync) $arguments += "/sync" $arguments += "/wait:$WaitSeconds" "Both")] [string]$Target = "Both"

Invoke-GPUpdate -Target Computer -Force -Verbose 4. Using Group Policy Cmdlets (RSAT) If you have Group Policy Management Console (RSAT) installed, use these PowerShell cmdlets. Import the module Import-Module GroupPolicy Key Cmdlets | Cmdlet | Purpose | |--------|---------| | Invoke-GPUpdate | Remotely triggers gpupdate on computers | | Get-GPResultantSetOfPolicy | Generates RSOP report (HTML/XML) | | Get-GPRegistryValue | Reads registry-based policy settings | | Set-GPRegistryValue | Configures registry policy | | Get-GPInheritance | Shows OU policy inheritance | Examples Remote gpupdate

Invoke-GPUpdate -Computer "PC01", "PC02" -Force -RandomDelayMinutes 5