gpupdate on Remote Machines

by Jun 6, 2014

To run gpupdate.exe remotely, you could use a script like this:

function Start-GPUpdate

    $code = {     
        $rv = 1 | Select-Object -Property ComputerName, ExitCode
        $null = gpupdate.exe /force
        $rv.Exitcode = $LASTEXITCODE
        $rv.ComputerName = $env:COMPUTERNAME
    Invoke-Command -ScriptBlock $code -ComputerName $ComputerName |
      Select-Object -Property ComputerName, ExitCode


Start-GPUpdate accepts one or more computer names and will then run gpupdate.exe on all of them. The result is transferred back to you.

This script takes advantage of PowerShell remoting, so it does require PowerShell remoting to be enabled on target machines, and you need to have local Admin privileges on these machines.

Twitter This Tip! ReTweet this Tip!