Advertisement
opexxx

How to refresh the Group Policy Settings on remote computers

May 3rd, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. The Group Policy Settings are refreshed as per the interval configured in the Group Policy for client computers, member servers and domain controllers. You can use the following command line tools to refresh the Group Policy Settings on remote computer. You need to log on to the computer manually and then perform the action suggested below:
  2.  
  3. For Windows XP computers:
  4.  
  5. Gpupdate.exe /Target:User /force
  6. Gpupdate.exe /Target:Computer /force
  7.  
  8. For Windows 2000
  9.  
  10. Secedit.exe /refreshpolicy user_policy
  11. Secedit.exe /refreshpolicy machine_policy
  12.  
  13. To refresh the policy on remote computer or computers you can use the following script to do so:
  14.  
  15.  
  16. Create a ComputerList.txt
  17. Put all the remote computers in the Text file.
  18. Use the Psexec.exe tool to execute the command remotely.
  19.  
  20. For Windows XP Computers:
  21.  
  22. Psexec.exe -@ComputerList.txt Gpupdate.exe /Target:User /force
  23. Psexec.exe -@ComputerList.txt Gpupdate.exe /Target:Computer /force
  24.  
  25. For Windows 2000 Computers:
  26.  
  27. Psexec.exe -@ComputerList.txt secedit.exe /refreshpolicy user_policy
  28. Psexec.exe -@ComputerList.txt secedit.exe /refreshpolicy machine_policy
  29.  
  30. The above Psexec.exe command will run on all the computers specified in the ComputerList.txt.
  31.  
  32. You can also use the following script to check the version of Operating System and then issue the command:
  33.  
  34. @echo off
  35.  
  36. XPGPORef1=gpupdate.exe /Target:User /force
  37. XPGPORef2=gpupdate.exe /Target:Computer /force
  38.  
  39. Win2kGPORef1=secedit.exe /refreshpolicy user_policy
  40. Win2kGPORef2=secedit.exe /refreshpolicy machine_policy
  41.  
  42. For /f β€œTokens=*” %%a in (ComputerList.txt) Do (
  43.  
  44. SET Comp_name=%%a
  45.  
  46. Ver.exe %comp_name% > Hostver.txt
  47.  
  48. Find /I β€œXP” < Hostver.txt > CheckCC.txt
  49.  
  50. IF %errorlevel% == 0 (
  51.  
  52. Psexec.exe %comp_name% Gpupdate.exe /Target:User /force
  53. Psexec.exe %comp_name% Gpupdate.exe /Target:Computer /force
  54.  
  55. ) ELSE (
  56.  
  57. Psexec.exe %comp_name% secedit.exe /refreshpolicy user_policy
  58. Psexec.exe %comp_name% secedit.exe /refreshpolicy machine_policy
  59. )
  60.  
  61. The above script will check the Operating System version by executing Ver.exe on remote computer and then run the appropriate commands to refresh the Group Policy Objects.
  62.  
  63. http://support.microsoft.com/kb/556027/en-us
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement