I think you have to modify %windir%system32GroupPolicygpt.ini
, appending [{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]
to the gPCMachineExtensionNames
line and incrementing the Version
value by one. (source).
Try adding and removing a script via group policy editor and you can watch how gpt.ini changes. When you add a script, you can also use the structure created in HKLMSOFTWAREMicrosoftWindowsCurrentVersionGroup PolicyScriptsStartup
as a template.
For anyone coming across this thread whose machine is a member of a domain, I've noticed that domain-defined group policies appear in the registry after local policies. So if you've already got a domain policy at ...ScriptsStartup
, you should copy it to ...ScriptsStartup1
before creating your local machine policy.
In any case, expirement with the GUI and see how stuff changes before attempting programmatically.
You'll also need to run gpupdate
to refresh group policies.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…