A. With Windows 7 and Server 2008 R2, you can use the included Group Policy cmdlets to perform many group policy actions from PowerShell. To use them, first start an elevated PowerShell console. Then import the grouppolicy module and use the New-GPLink cmdlet with the name of the GPO to link and the target, as shown here.
new-gplink -name "Sales GPO" -target "dc=savilltech,dc=net"
GpoId : d3672844-2875-4b72-a8c4-3df031149bb5 DisplayName : Sales GPO Enabled : True Enforced : False Target : DC=savilltech,DC=net Order : 4
You can also use the -enforced yes switch to force enforcement and -LinkEnabled to set enabled state (e.g. -LinkEnabled No).
Note that you can pass the output of a New-GPO cmdlet to the New-GPLink cmdlet to both create and link using one command, as shown below.
New-GPO "Test GPO" | New-GPLink -target "dc=savilltech,dc=net"
GpoId : e1dfcba2-a397-41e9-a978-c01cf9361e7e DisplayName : Test GPO Enabled : True Enforced : False Target : DC=savilltech,DC=net Order : 5
You could also use the set-gppermissions cmdlet to modify the permissions on the link you created.
- Q: Does Windows provide a mechanism to enforce the auditing of all file system or registry object actions that specific users or groups perform on a Windows system or domain?
- Use Group Policy to Deploy Commonly Used IE Plug-Ins
- Review: Group Policy Management Tools
- How do I delegate permissions for someone to edit a GPO?
Check out hundreds more useful Q&As like this in John Savill's FAQ for Windows. Also, watch instructional videos made by John at ITTV.net.