如何使用批处理文件编辑特定的组策略
我在一个学区的 700 多台计算机上工作,并编写了一个小程序,我打算将其写入 CD。该程序设置为插入磁盘时自动运行,并提示计算机的屏幕分辨率以及建筑物所在的计算机(不同的教学楼)。然后,程序将运行一个批处理文件,将默认桌面从磁盘复制到 windows\web\wallpaper 目录中。它还替换了为学区定制的其他文件。
要完成计算机主题的更改,我需要让文件对组策略和注册表进行一些编辑。我如何才能使用该程序来进行这些更改?是否将其全部写入批处理中,或者批处理是否必须启动另一个文件(如注册表文件)?
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
组策略编辑器所做的只是设置注册表项。如果您可以确定为所需策略设置了哪些键,则可以使用 reg.exe 来设置这些键。
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.
注册表将对第一个用户起作用,但在新用户登录后,GP 将为新用户更改这些设置。
要进行部署 GP,请执行以下操作: 将一台计算机的 GP 设置为您想要的方式。完成后,转到 C:\windows\System32\GroupPolicy 并复制内容。 (注意:这是一个隐藏文件)。在您想要的下一台计算机上,只需将文件粘贴回即可。
如果您批量执行此操作,则必须以管理员身份运行该批处理才能触摸 C:\windows\system32 文件夹。 (UAC,IT 祸根)
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)