Discussion Locked

Force Group Policy to Update Remotely

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How can I force all of the computers in the domain to immediately update their group policy settings without forcing the computers to restart?

Note: All of my servers are Windows 2003 and all of my clients are Windows XP SP 2.

7 replies

by keebmachine

I should have stated that I would like to update all of the computers from a central location without having to visit each computer.

by dfinch

On a workstation, use: gpupdate.exe /force

For many machines, insert this command into the logon batch file located in the Netlogon share on a domain controller.

Other command options are available.

by keebmachine

I need this to be done without restarting, logging off or anything like that. Thanks for the help.

by keebmachine

Here is the solution and it is absolutely AWESOME!!!

copy the text below into a text editor and save it as remotecommand.vbs

This can be used to execute any command on any windows computer that you have admin rights to.

Syntax: cscript.exe remotecommand.vbs COMPUTER1 "gpupdate.exe /force"

Use the following syntax

' Executes a command on a remote system using WMI Scripting
' syntax remotecommand.vbs Computer1 "GPUPDATE /force > C:\logs\VH-ad-01.txt

strComputer = WScript.Arguments.Item(0)
strCommand = WScript.Arguments.Item(1)

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\root\cimv2:Win32_Process")

errReturn = objWMIService.Create(strCommand,null,null,intProcessID)
if errReturn = 0 Then
Wscript.Echo strCommand & " was started with a process ID of " _
& intProcessID & "."
Else
Wscript.Echo strCommand & " could not be started due to error " & errReturn & "."
End If

by scottie_lipa

Thank you for making my life a whole lot easier! This vbs allowed me to force some clients to run a windows update check to my SUS server, w/o getting the user involved, w/o me walking to each box or waiting until the next day.

This discussion is closed to new replies.