Group Policy Cmdlets in Windows PowerShell
Posted by John Policelli on November 5th, 2009
Microsoft has made Group Policy cmdlets for Windows PowerShell available. These cmdlets, roughly 25 in total, can be used to:
- Maintain GPOs (create, remove, backup, reporting, and import)
- Associate GPOs with AD DS containers (link, update, and remove)
- Set inheritance and permissions on AD DS OUs and domains
- Configure registry-based settings and Group Policy Preferences Registry settings
The Windows Server 2008 R2 and Windows 7 Remote Server Administration Tools (RSAT) tools include the new version of GPMC, as well as the Group Policy cmdlets. Therefore, you can only use the Group Policy cmdlets on:
- Windows Server 2008 R2 domain controllers
- Windows Server 2008 R2 member servers that have GPMC installed
- Windows 7 with RSAT installed
The following table lists the Group Policy cmdlets, as well as the description for each.
|
Name |
Description |
| Backup-GPO | Backs up one GPO or all the GPOs in a domain. |
| Copy-GPO | Copies a GPO. |
| Get-GPInheritance | Retrieves Group Policy inheritance information for a specified domain or OU. |
| Get-GPO | Gets one GPO or all the GPOs in a domain. |
| Get-GPOReport | Generates a report in either XML or HTML format for a specified GPO or for all GPOs in a domain. |
| Get-GPPermissions | Gets the permission level for one or more security principals on a specified GPO. |
| Get-GPPrefRegistryValue | Retrieves one or more registry preference items under either Computer Configuration or User Configuration in a GPO. |
| Get-GPRegistryValue | Retrieves one or more registry-based policy settings under either Computer Configuration or User Configuration in a GPO. |
| Get-GPResultantSetOfPolicy | Outputs the Resultant Set of Policy (RSoP) information to a file, for a user, a computer, or both. |
| Get-GPStarterGPO | Gets one Starter GPO or all Starter GPOs in a domain. |
| Import-GPO | Imports the Group Policy settings from a backed-up GPO into a specified GPO. |
| New-GPLink | Links a GPO to a site, domain, or OU. |
| New-GPO | Creates a new GPO. |
| New-GPStarterGPO | Creates a new Starter GPO. |
| Remove-GPLink | Removes a GPO link from a site, domain, or OU. |
| Remove-GPO | Deletes a GPO. |
| Remove-GPPrefRegistryValue | Removes one or more registry preference items from either Computer Configuration or User Configuration in a GPO. |
| Remove-GPRegistryValue | Removes one or more registry-based policy settings from either Computer Configuration or User Configuration in a GPO. |
| Rename-GPO | Assigns a new display name to a GPO. |
| Restore-GPO | Restores one GPO or all GPOs in a domain from one or more GPO backup files. |
| Set-GPInheritance | Blocks or unblocks inheritance for a specified domain or OU. |
| Set-GPLink | Sets the properties of the specified GPO link. |
| Set-GPPermissions | Grants a level of permissions to a security principal for one GPO or for all the GPOs in a domain. |
| Set-GPPrefRegistryValue | Configures a registry preference item under either Computer Configuration or User Configuration in a GPO. |
| Set-GPRegistryValue | Configures one or more registry-based policy settings under either Computer Configuration or User Configuration in a GPO. |
For more information on the Group Policy cmdlets in Windows PowerShell, see the following: http://technet.microsoft.com/en-us/library/ee461027.aspx


