What I need to do is to modify local group policy and local security policy on different machine.It is very inconvenient to modify them each item, so I want to find out any way that can modify them through programming. I have tried the way in this website,but it didn't work. What I need to modify are shown as below:
1.Launch the Local/Group Policy Editor.
Disable Windows update option at shutdown Go to Computer Configuration -> Administrative Templates -> Windows Components -> Windows Updates, and double click on Windows Updates.
set "Do not display 'Install Updates and Shut Down'" to Enable.
Set "Display Shutdown Event Tracker" in Group Policy Editor to Disabled.
Computer Configuration->Administrative Templates->System. Set "Display Shutdown Event Tracker" to Disabled.
Computer Configuration->Windows Settings->Security Settings->Local Policies->Security Options.
Set the group policy option "Shutdown: Allow system to be shut down without having to log on" to Disabled.
2.Launch the Local Security Policy(run secpol.msc).
Security Settings->Local Policies->Security Options.
Set the “Interactive logon: Do not display last username" option to Enabled.
Security Settings->Local Policies->User Rights Assignment.
Add the user Administrator to "Deny logon through terminal services".
Security Settings->Account Policies > Password Policy
Set the "Password must meet complexity requirements"
By the way, the windows operation is Windows server 2008r2 and windows server 2012r2.