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

Posted in: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s