SECURITY

Windows Server 2008 and Windows Vista : GPO Security (part 2)

11/15/2013 6:39:10 PM

4. SetGPOPermissionsBySOM.wsf

This script grants the specified permission for the security principal specified to all GPOs in the SOM of the site, domain, or organizational unit targeted. Complete control is allowed with this script and switches; the Replace, None, and Recursive options allow you to tailor your permission and scope of the permission.

Syntax

Usage: SetGPOPermissionsBySOM.wsf SOM Group /Permission:value [/Replace] [/Recursive]
[/Domain:value]
SOM: Name of the site, domain, or OU to process.
Group: Name of the group or user to grant permissions to.
Permission: Permission to grant. Can be "Read," "Apply," "Edit," "FullEdit," or "None."
Replace: Replaces any existing permissions for the specified trustee. Otherwise, the script
simply ensures that the trustee has at least the permission level specified.
Recursive: Applies the changes to all child OUs as well.
Domain: DNS name of domain.


Example & Output

This example contains an error. The /Recursive switch was used, but there was not a linked GPO in Test OU.

cscript SetGPOPermissionsBySOM.wsf Servers "Server Operators" /Permission:Read /Recursive
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
Updating all GPOs linked to OU Servers to give Read rights to Server Operators

Updating all GPOs linked to OU Model Office to give Read rights to Server Operators

Updating permissions on linked GPO 'Hardened Server GPO'

Updating all GPOs linked to OU Production to give Read rights to Server Operators
Updating permissions on linked GPO 'Hardened Server GPO'

Updating all GPOs linked to OU Test to give Read rights to Server Operators
Error getting SOM CN=Servers,CN=Default-First-Site-
Name,CN=Sites,CN=Configuration,DC=Fabrikam,DC=com

5. SetSOMPermissions.wsf

This script targets the delegation that can be set for the Active Directory nodes where you can link GPOs. Because this is a function that affects only the appropriate permissions, there must be a domain controller running Windows Server 2003 or Windows Server 2008 so you can leverage the RSoP Planning permission.

Syntax

Usage: SetSOMPermissions.wsf SOM Group /Permission:value [/Inherit] [/Domain:value]
SOM: Name of the site, domain, or OU to process.
Group: Name of the group or user to grant permissions to.
Permission: Permission to grant. Can be "LinkGPOs," "RSoPLogging," "RSoPPlanning," "All,"
or "None."
Inherit: Specifies that the permission should be inherited by all child containers.
Domain: DNS name of domain.


Example #1 & Output

In Example#1, you add RSOPLogging to all of the GPOs for the Server Operators group. In Example#2, you add RSOPPlanning to all of the GPOs for the Server Operators group.

cscript SetSOMPermissions.wsf Servers "server operators" /Permission:RSOPLogging /inherit
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Added the 'RSoP Logging Mode' permission for server operators.


Example #2 & Output

cscript SetSOMPermissions.wsf Servers "server operators" /Permission:RSOPPlanning /inherit
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Added the 'RSoP Planning Mode' permission for server operators.


Direct from the Source: The Scripting Group Policy Landscape

GPMC provides an important interface into Group Policy management. You may be familiar with the GPMC GUI, but the GPMC scripts provide a great tool for automating management of Group Policy objects themselves. All of the tasks that you can perform with the GUI can also be automated by using the supplied GPMC scripts; you can also create custom scripts by using the scripting model that GPMC provides. Automation tasks also include management of GPOs as a whole. That is, you create and delete GPOs, link them to Active Directory containers, back them up and restore or import them, and even generate Group Policy Results reports—all from scripts.

If you are a Windows PowerShell scripter, you can also leverage the GPMC scripting interfaces from that scripting environment, because they are just COM objects that you can call directly from your Windows PowerShell scripts by using the New-Object cmdlet. In addition, a set of free Windows PowerShell cmdlets makes it easy to leverage much of the GPMC functionality from Windows PowerShell. You can find these at www.sdmsoftware.com/freeware.php.

The GPMC is lacking, however, when it comes to modifying the settings within GPOs via scripts or some other automated mechanism. There are no scripting interfaces into Group Policy settings. Microsoft does provide the IGroupPolicyObject C++ interface (for more details, you can search for that interface name on http://msdn.microsoft.com) for programmatically accessing some parts of Group Policy, namely registry policy, but this interface is not easily accessible via Microsoft Visual Basic, Scripting Edition (VBScript) or other COM-based scripting languages.

The SDM Software GPExpert™ Scripting Toolkit for PowerShell exposes Group Policy settings to scripting interfaces. It supports VBScript (although it is designed to work primarily with Windows PowerShell), and it provides a mechanism for reading, searching, and writing settings within most of the supported policy areas in Windows Vista, Windows XP, Windows Server 2003, and Windows Server 2008.

Other  
  •  Windows Server 2008 and Windows Vista : Advanced Group Policy Management Delegation - Approving, Reviewing
  •  Windows Server 2008 and Windows Vista : Advanced Group Policy Management Delegation - Full Control, Editing
  •  Windows Server 2008 and Windows Vista : Group Policy Management Console Delegation - Modeling GPOs, RSoP of GPOs
  •  Windows Server 2008 and Windows Vista : Group Policy Management Console Delegation - Managing GPOs, Editing GPOs
  •  Windows Server 2008 and Windows Vista : Group Policy Management Console Delegation - Linking GPOs
  •  Windows Server 2008 and Windows Vista : Group Policy Management Console Delegation - Creating GPOs
  •  Windows Server 2008 and Windows Vista : Security Delegation for Administration of GPOs - Default Security Environment
  •  Programming WCF Services : Security - Intranet Application Scenario (part 7) - Identity Management, Callbacks
  •  Programming WCF Services : Security - Intranet Application Scenario (part 6) - Authorization
  •  Programming WCF Services : Security - Intranet Application Scenario (part 5) - Impersonation - Impersonating all operations, Restricting impersonation
  •  
    Top 10
    Review : Sigma 24mm f/1.4 DG HSM Art
    Review : Canon EF11-24mm f/4L USM
    Review : Creative Sound Blaster Roar 2
    Review : Philips Fidelio M2L
    Review : Alienware 17 - Dell's Alienware laptops
    Review Smartwatch : Wellograph
    Review : Xiaomi Redmi 2
    Extending LINQ to Objects : Writing a Single Element Operator (part 2) - Building the RandomElement Operator
    Extending LINQ to Objects : Writing a Single Element Operator (part 1) - Building Our Own Last Operator
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8