Force GP-Update remotely with Powershell 3.0

One of the new features of Windows Server 2012 is the “invoke-gpudate” cmdlet in powershell 3.0.

 

With this cmdlet you can force any single client to do a grupdate without having to access the client directly, really cool i think!

 

To make it easier i wrote a short script, that triggers the gpupdate on only one Client with a two minute delay:

 

function Pause ($Message="GPudate successfully sent. Computer will update Policy in 2 Minutes. Press any key to close")
{
write-host –NoNewLine $Message
$null = $host.UI.rawUI.ReadKey("NoEcho,IncludeKeyDown")
write-host ""
}

$computername = read-host "Please type in FQDN of the Computer to update policy (e.g. pc4711.domain.local) "
invoke-gpupdate -computer $computername -randomdelayinminutes 2 -force

Pause

This script can be run without having any server 2012 installed, all you need is Windows 8 with installed Remote Server Administratio tools for Windows 8.

 

More info on Technet

Leave a Reply

Your email address will not be published. Required fields are marked *