Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could you edit a specific group policy using a batch file

Im working on over 700 computers in a school district and have written a small program that i intend to write to a cd. The program is set to autorun when the disk is inserted and prompt the screen resolution of the computer and what computer the building is in (the different school buildings). Afterwards the program will run a batch file that copies a default desktop from the disk and into the windows\web\wallpaper directory. It also replaces other files that have been customized for the school district.

To finish changing the theme of the computer, i need to have the file make a few edits to the group policy and the registry. How would i be able to use the program to makes these changes? Would it all be written into the batch or would the batch have to initiate another file (like a registry file)?

like image 466
Matt Shank Avatar asked Feb 26 '23 09:02

Matt Shank


2 Answers

All the group policy editor does is set registry keys. If you can identify what keys are being set for the policy you want, you can use reg.exe to set those keys.

reg.exe add HKCU\Software\path\to\regkey\ /v valuename /d newvalue
like image 59
Ryan Bemrose Avatar answered Mar 08 '23 02:03

Ryan Bemrose


Registry will work for the first user, but after a new user logs in, GP will change those settings for the new user.

To make deployment gp, do this: Set one machine's GP to the way you want it. Once you are done, goto C:\windows\System32\GroupPolicy and copy the contents. (note: this is a hidden file). On the next machines you want, just paste back in the file.

If you do this in a batch, you will have to run the batch as administrator to touch the C:\windows\system32 folder. (UAC, the bane IT)

like image 33
CodePrime8 Avatar answered Mar 08 '23 01:03

CodePrime8