[英]Edit a GPO with a script
Is it possible to use a batch file to edit a local GPO ? 是否可以使用批处理文件来编辑本地GPO?
What I am exactly trying to do: 我到底想做什么:
I am not looking for you to create the script. 我不是要您创建脚本。 I just want to know if this is possible to do it with a batch file & and some idea to help me start with this task.
我只想知道是否可以使用批处理文件来完成此操作,并且想出一些办法来帮助我开始执行此任务。
This procedure is not really complicated and can be done manually. 此过程实际上并不复杂,可以手动完成。 Given that I have to apply these change for a lot of computer, I am looking for a fastest way than doing it from the "gpedit.msc".
鉴于我必须将这些更改应用到很多计算机上,因此我正在寻找一种比从“ gpedit.msc”进行更改的最快方法。
Yes , it is possible to edit the local GPO using a Batch script. 是的 ,可以使用批处理脚本来编辑本地GPO。 Simply manipulate the GPO by editing the registry keys.
只需通过编辑注册表项来操纵GPO。 Note: Depending upon the GPO setting changed through the registry, you may need to log the user off before the change takes effect.
注意:根据通过注册表更改的GPO设置,您可能需要注销用户才能使更改生效。
Step 1 第1步
Step 2 第2步
HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient!AppendToMultiLabelName
HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient!AppendToMultiLabelName
Step 3 第三步
reg add
command to edit the values as you need reg add
命令根据需要编辑值 @reg add "HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f
@reg add "HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f
Note 注意
Machine
and User
section of the registry along with the WOW
section. Machine
和“ User
部分以及“ WOW
部分中编辑GPO注册表项。 @reg add "HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @reg add "HKLM\\Software\\Wow6432Node\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @for /f "delims=" %A in ('reg query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Group Policy Objects" /k /f "*Machine" ^| find /i "HKEY"') do @reg add "%~A\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @reg add "%~A\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f
@reg add "HKLM\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @reg add "HKLM\\Software\\Wow6432Node\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @for /f "delims=" %A in ('reg query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Group Policy Objects" /k /f "*Machine" ^| find /i "HKEY"') do @reg add "%~A\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f & @reg add "%~A\\Software\\Policies\\Microsoft\\Windows NT\\DNSClient" /v AppendToMultiLabelName /t REG_DWORD /d 1 /f
Breakdown of example: 细分示例:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.