Advertisement
Guest User

Gpo script pastebin 2022

a guest
Nov 12th, 2024
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.38 KB | None | 0 0
  1. -
  2. Download Here --> https://tinyurl.com/589dan33 (Copy and Paste Link)
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. Block or report GPO-Script
  10. Contact GitHub support about this user’s behavior. Learn more about reporting abuse.
  11. Popular repositories
  12. 5 contributions in the last year
  13. No contributions on Sunday, April 3, 2022 No contributions on Monday, April 4, 2022 No contributions on Tuesday, April 5, 2022 No contributions on Wednesday, April 6, 2022 No contributions on Thursday, April 7, 2022 No contributions on Friday, April 8, 2022 No contributions on Saturday, April 9, 2022 No contributions on Sunday, April 10, 2022 No contributions on Monday, April 11, 2022 No contributions on Tuesday, April 12, 2022 No contributions on Wednesday, April 13, 2022 No contributions on Thursday, April 14, 2022 No contributions on Friday, April 15, 2022 No contributions on Saturday, April 16, 2022 No contributions on Sunday, April 17, 2022 No contributions on Monday, April 18, 2022 No contributions on Tuesday, April 19, 2022 No contributions on Wednesday, April 20, 2022 No contributions on Thursday, April 21, 2022 No contributions on Friday, April 22, 2022 No contributions on Saturday, April 23, 2022 No contributions on Sunday, April 24, 2022 No contributions on Monday, April 25, 2022 No contributions on Tuesday, April 26, 2022 No contributions on Wednesday, April 27, 2022 No contributions on Thursday, April 28, 2022 No contributions on Friday, April 29, 2022 No contributions on Saturday, April 30, 2022 No contributions on Sunday, May 1, 2022 No contributions on Monday, May 2, 2022 No contributions on Tuesday, May 3, 2022 No contributions on Wednesday, May 4, 2022 No contributions on Thursday, May 5, 2022 No contributions on Friday, May 6, 2022 No contributions on Saturday, May 7, 2022 No contributions on Sunday, May 8, 2022 No contributions on Monday, May 9, 2022 No contributions on Tuesday, May 10, 2022 No contributions on Wednesday, May 11, 2022 No contributions on Thursday, May 12, 2022 No contributions on Friday, May 13, 2022 No contributions on Saturday, May 14, 2022 No contributions on Sunday, May 15, 2022 No contributions on Monday, May 16, 2022 No contributions on Tuesday, May 17, 2022 No contributions on Wednesday, May 18, 2022 No contributions on Thursday, May 19, 2022 No contributions on Friday, May 20, 2022 No contributions on Saturday, May 21, 2022 No contributions on Sunday, May 22, 2022 No contributions on Monday, May 23, 2022 No contributions on Tuesday, May 24, 2022 No contributions on Wednesday, May 25, 2022 No contributions on Thursday, May 26, 2022 No contributions on Friday, May 27, 2022 No contributions on Saturday, May 28, 2022 No contributions on Sunday, May 29, 2022 No contributions on Monday, May 30, 2022 No contributions on Tuesday, May 31, 2022 No contributions on Wednesday, June 1, 2022 No contributions on Thursday, June 2, 2022 No contributions on Friday, June 3, 2022 No contributions on Saturday, June 4, 2022 No contributions on Sunday, June 5, 2022 No contributions on Monday, June 6, 2022 No contributions on Tuesday, June 7, 2022 No contributions on Wednesday, June 8, 2022 No contributions on Thursday, June 9, 2022 No contributions on Friday, June 10, 2022 No contributions on Saturday, June 11, 2022 No contributions on Sunday, June 12, 2022 No contributions on Monday, June 13, 2022 No contributions on Tuesday, June 14, 2022 No contributions on Wednesday, June 15, 2022 No contributions on Thursday, June 16, 2022 No contributions on Friday, June 17, 2022 No contributions on Saturday, June 18, 2022 No contributions on Sunday, June 19, 2022 No contributions on Monday, June 20, 2022 No contributions on Tuesday, June 21, 2022 No contributions on Wednesday, June 22, 2022 No contributions on Thursday, June 23, 2022 No contributions on Friday, June 24, 2022 No contributions on Saturday, June 25, 2022 No contributions on Sunday, June 26, 2022 No contributions on Monday, June 27, 2022 No contributions on Tuesday, June 28, 2022 No contributions on Wednesday, June 29, 2022 No contributions on Thursday, June 30, 2022 No contributions on Friday, July 1, 2022 No contributions on Saturday, July 2, 2022 No contributions on Sunday, July 3, 2022 No contributions on Monday, July 4, 2022 No contributions on Tuesday, July 5, 2022 No contributions on Wednesday, July 6, 2022 No contributions on Thursday, July 7, 2022 1 contribution on Friday, July 8, 2022 4 contributions on Saturday, July 9, 2022 No contributions on Sunday, July 10, 2022 No contributions on Monday, July 11, 2022 No contributions on Tuesday, July 12, 2022 No contributions on Wednesday, July 13, 2022 No contributions on Thursday, July 14, 2022 No contributions on Friday, July 15, 2022 No contributions on Saturday, July 16, 2022 No contributions on Sunday, July 17, 2022 No contributions on Monday, July 18, 2022 No contributions on Tuesday, July 19, 2022 No contributions on Wednesday, July 20, 2022 No contributions on Thursday, July 21, 2022 No contributions on Friday, July 22, 2022 No contributions on Saturday, July 23, 2022 No contributions on Sunday, July 24, 2022 No contributions on Monday, July 25, 2022 No contributions on Tuesday, July 26, 2022 No contributions on Wednesday, July 27, 2022 No contributions on Thursday, July 28, 2022 No contributions on Friday, July 29, 2022 No contributions on Saturday, July 30, 2022 No contributions on Sunday, July 31, 2022 No contributions on Monday, August 1, 2022 No contributions on Tuesday, August 2, 2022 No contributions on Wednesday, August 3, 2022 No contributions on Thursday, August 4, 2022 No contributions on Friday, August 5, 2022 No contributions on Saturday, August 6, 2022 No contributions on Sunday, August 7, 2022 No contributions on Monday, August 8, 2022 No contributions on Tuesday, August 9, 2022 No contributions on Wednesday, August 10, 2022 No contributions on Thursday, August 11, 2022 No contributions on Friday, August 12, 2022 No contributions on Saturday, August 13, 2022 No contributions on Sunday, August 14, 2022 No contributions on Monday, August 15, 2022 No contributions on Tuesday, August 16, 2022 No contributions on Wednesday, August 17, 2022 No contributions on Thursday, August 18, 2022 No contributions on Friday, August 19, 2022 No contributions on Saturday, August 20, 2022 No contributions on Sunday, August 21, 2022 No contributions on Monday, August 22, 2022 No contributions on Tuesday, August 23, 2022 No contributions on Wednesday, August 24, 2022 No contributions on Thursday, August 25, 2022 No contributions on Friday, August 26, 2022 No contributions on Saturday, August 27, 2022 No contributions on Sunday, August 28, 2022 No contributions on Monday, August 29, 2022 No contributions on Tuesday, August 30, 2022 No contributions on Wednesday, August 31, 2022 No contributions on Thursday, September 1, 2022 No contributions on Friday, September 2, 2022 No contributions on Saturday, September 3, 2022 No contributions on Sunday, September 4, 2022 No contributions on Monday, September 5, 2022 No contributions on Tuesday, September 6, 2022 No contributions on Wednesday, September 7, 2022 No contributions on Thursday, September 8, 2022 No contributions on Friday, September 9, 2022 No contributions on Saturday, September 10, 2022 No contributions on Sunday, September 11, 2022 No contributions on Monday, September 12, 2022 No contributions on Tuesday, September 13, 2022 No contributions on Wednesday, September 14, 2022 No contributions on Thursday, September 15, 2022 No contributions on Friday, September 16, 2022 No contributions on Saturday, September 17, 2022 No contributions on Sunday, September 18, 2022 No contributions on Monday, September 19, 2022 No contributions on Tuesday, September 20, 2022 No contributions on Wednesday, September 21, 2022 No contributions on Thursday, September 22, 2022 No contributions on Friday, September 23, 2022 No contributions on Saturday, September 24, 2022 No contributions on Sunday, September 25, 2022 No contributions on Monday, September 26, 2022 No contributions on Tuesday, September 27, 2022 No contributions on Wednesday, September 28, 2022 No contributions on Thursday, September 29, 2022 No contributions on Friday, September 30, 2022 No contributions on Saturday, October 1, 2022 No contributions on Sunday, October 2, 2022 No contributions on Monday, October 3, 2022 No contributions on Tuesday, October 4, 2022 No contributions on Wednesday, October 5, 2022 No contributions on Thursday, October 6, 2022 No contributions on Friday, October 7, 2022 No contributions on Saturday, October 8, 2022 No contributions on Sunday, October 9, 2022 No contributions on Monday, October 10, 2022 No contributions on Tuesday, October 11, 2022 No contributions on Wednesday, October 12, 2022 No contributions on Thursday, October 13, 2022 No contributions on Friday, October 14, 2022 No contributions on Saturday, October 15, 2022 No contributions on Sunday, October 16, 2022 No contributions on Monday, October 17, 2022 No contributions on Tuesday, October 18, 2022 No contributions on Wednesday, October 19, 2022 No contributions on Thursday, October 20, 2022 No contributions on Friday, October 21, 2022 No contributions on Saturday, October 22, 2022 No contributions on Sunday, October 23, 2022 No contributions on Monday, October 24, 2022 No contributions on Tuesday, October 25, 2022 No contributions on Wednesday, October 26, 2022 No contributions on Thursday, October 27, 2022 No contributions on Friday, October 28, 2022 No contributions on Saturday, October 29, 2022 No contributions on Sunday, October 30, 2022 No contributions on Monday, October 31, 2022 No contributions on Tuesday, November 1, 2022 No contributions on Wednesday, November 2, 2022 No contributions on Thursday, November 3, 2022 No contributions on Friday, November 4, 2022 No contributions on Saturday, November 5, 2022 No contributions on Sunday, November 6, 2022 No contributions on Monday, November 7, 2022 No contributions on Tuesday, November 8, 2022 No contributions on Wednesday, November 9, 2022 No contributions on Thursday, November 10, 2022 No contributions on Friday, November 11, 2022 No contributions on Saturday, November 12, 2022 No contributions on Sunday, November 13, 2022 No contributions on Monday, November 14, 2022 No contributions on Tuesday, November 15, 2022 No contributions on Wednesday, November 16, 2022 No contributions on Thursday, November 17, 2022 No contributions on Friday, November 18, 2022 No contributions on Saturday, November 19, 2022 No contributions on Sunday, November 20, 2022 No contributions on Monday, November 21, 2022 No contributions on Tuesday, November 22, 2022 No contributions on Wednesday, November 23, 2022 No contributions on Thursday, November 24, 2022 No contributions on Friday, November 25, 2022 No contributions on Saturday, November 26, 2022 No contributions on Sunday, November 27, 2022 No contributions on Monday, November 28, 2022 No contributions on Tuesday, November 29, 2022 No contributions on Wednesday, November 30, 2022 No contributions on Thursday, December 1, 2022 No contributions on Friday, December 2, 2022 No contributions on Saturday, December 3, 2022 No contributions on Sunday, December 4, 2022 No contributions on Monday, December 5, 2022 No contributions on Tuesday, December 6, 2022 No contributions on Wednesday, December 7, 2022 No contributions on Thursday, December 8, 2022 No contributions on Friday, December 9, 2022 No contributions on Saturday, December 10, 2022 No contributions on Sunday, December 11, 2022 No contributions on Monday, December 12, 2022 No contributions on Tuesday, December 13, 2022 No contributions on Wednesday, December 14, 2022 No contributions on Thursday, December 15, 2022 No contributions on Friday, December 16, 2022 No contributions on Saturday, December 17, 2022 No contributions on Sunday, December 18, 2022 No contributions on Monday, December 19, 2022 No contributions on Tuesday, December 20, 2022 No contributions on Wednesday, December 21, 2022 No contributions on Thursday, December 22, 2022 No contributions on Friday, December 23, 2022 No contributions on Saturday, December 24, 2022 No contributions on Sunday, December 25, 2022 No contributions on Monday, December 26, 2022 No contributions on Tuesday, December 27, 2022 No contributions on Wednesday, December 28, 2022 No contributions on Thursday, December 29, 2022 No contributions on Friday, December 30, 2022 No contributions on Saturday, December 31, 2022 No contributions on Sunday, January 1, 2023 No contributions on Monday, January 2, 2023 No contributions on Tuesday, January 3, 2023 No contributions on Wednesday, January 4, 2023 No contributions on Thursday, January 5, 2023 No contributions on Friday, January 6, 2023 No contributions on Saturday, January 7, 2023 No contributions on Sunday, January 8, 2023 No contributions on Monday, January 9, 2023 No contributions on Tuesday, January 10, 2023 No contributions on Wednesday, January 11, 2023 No contributions on Thursday, January 12, 2023 No contributions on Friday, January 13, 2023 No contributions on Saturday, January 14, 2023 No contributions on Sunday, January 15, 2023 No contributions on Monday, January 16, 2023 No contributions on Tuesday, January 17, 2023 No contributions on Wednesday, January 18, 2023 No contributions on Thursday, January 19, 2023 No contributions on Friday, January 20, 2023 No contributions on Saturday, January 21, 2023 No contributions on Sunday, January 22, 2023 No contributions on Monday, January 23, 2023 No contributions on Tuesday, January 24, 2023 No contributions on Wednesday, January 25, 2023 No contributions on Thursday, January 26, 2023 No contributions on Friday, January 27, 2023 No contributions on Saturday, January 28, 2023 No contributions on Sunday, January 29, 2023 No contributions on Monday, January 30, 2023 No contributions on Tuesday, January 31, 2023 No contributions on Wednesday, February 1, 2023 No contributions on Thursday, February 2, 2023 No contributions on Friday, February 3, 2023 No contributions on Saturday, February 4, 2023 No contributions on Sunday, February 5, 2023 No contributions on Monday, February 6, 2023 No contributions on Tuesday, February 7, 2023 No contributions on Wednesday, February 8, 2023 No contributions on Thursday, February 9, 2023 No contributions on Friday, February 10, 2023 No contributions on Saturday, February 11, 2023 No contributions on Sunday, February 12, 2023 No contributions on Monday, February 13, 2023 No contributions on Tuesday, February 14, 2023 No contributions on Wednesday, February 15, 2023 No contributions on Thursday, February 16, 2023 No contributions on Friday, February 17, 2023 No contributions on Saturday, February 18, 2023 No contributions on Sunday, February 19, 2023 No contributions on Monday, February 20, 2023 No contributions on Tuesday, February 21, 2023 No contributions on Wednesday, February 22, 2023 No contributions on Thursday, February 23, 2023 No contributions on Friday, February 24, 2023 No contributions on Saturday, February 25, 2023 No contributions on Sunday, February 26, 2023 No contributions on Monday, February 27, 2023 No contributions on Tuesday, February 28, 2023 No contributions on Wednesday, March 1, 2023 No contributions on Thursday, March 2, 2023 No contributions on Friday, March 3, 2023 No contributions on Saturday, March 4, 2023 No contributions on Sunday, March 5, 2023 No contributions on Monday, March 6, 2023 No contributions on Tuesday, March 7, 2023 No contributions on Wednesday, March 8, 2023 No contributions on Thursday, March 9, 2023 No contributions on Friday, March 10, 2023 No contributions on Saturday, March 11, 2023 No contributions on Sunday, March 12, 2023 No contributions on Monday, March 13, 2023 No contributions on Tuesday, March 14, 2023 No contributions on Wednesday, March 15, 2023 No contributions on Thursday, March 16, 2023 No contributions on Friday, March 17, 2023 No contributions on Saturday, March 18, 2023 No contributions on Sunday, March 19, 2023 No contributions on Monday, March 20, 2023 No contributions on Tuesday, March 21, 2023 No contributions on Wednesday, March 22, 2023 No contributions on Thursday, March 23, 2023 No contributions on Friday, March 24, 2023 No contributions on Saturday, March 25, 2023 No contributions on Sunday, March 26, 2023 No contributions on Monday, March 27, 2023 No contributions on Tuesday, March 28, 2023 No contributions on Wednesday, March 29, 2023 No contributions on Thursday, March 30, 2023 No contributions on Friday, March 31, 2023 No contributions on Saturday, April 1, 2023 No contributions on Sunday, April 2, 2023 No contributions on Monday, April 3, 2023 No contributions on Tuesday, April 4, 2023 No contributions on Wednesday, April 5, 2023
  14. Group Policy Management Console Scripting Samples
  15. The following information describes the Group Policy Management Console (GPMC) scripting samples. These samples were originally found in the "%programfiles%\Gpmc\Scripts" directory after you installed the GPMC, and now can be found on the TechNet Code Gallery. You can execute the scripts at the command prompt. The scripts send output to the Command Prompt window. Run the scripts using the CScript.exe application.
  16. The following script samples address administrative tasks:
  17.  
  18. Backing up an Individual GPO
  19. Backing up the GPOs in a Domain
  20. Creating a Copy of a GPO
  21. Creating a New GPO
  22. Creating a Policy Environment Using an XML File
  23. Creating an XML File that Represents a Policy Environment
  24. Create Migration Table
  25. Deleting a GPO
  26. Grant Permissions for all GPOs in a Domain
  27. Importing a GPO
  28. Importing Multiple GPOs into a Domain
  29. Restoring a GPO
  30. Restoring All GPOs in a Domain
  31. Setting GPO Permissions
  32. Setting Permissions for all GPOs Linked to a Scope of Management
  33. Setting Permissions to Create GPOs
  34. Setting Policy-related Permissions on a SOM
  35.  
  36. There are also script samples that perform the following queries:
  37.  
  38. Listing All GPOs in a Domain
  39. Listing Disabled GPOs
  40. Listing GPO Information
  41. Listing GPOs at a Backup Location
  42. Listing GPOs by Policy Extension
  43. Listing GPOs by Security Group
  44. Listing GPOs Orphaned in SYSVOL
  45. Listing GPOs With Duplicate Names
  46. Listing GPOs Without Security Filtering
  47. Listing SOM Information
  48. Listing SOMs With Links to GPOs in External Domains
  49. Listing Unlinked GPOs in a Domain
  50. Printing the SOM Policy Tree
  51. Generate Reports for all GPOs
  52. Generate Reports for a GPO
  53.  
  54. Backing Up an Individual GPO
  55. The BackupGPO.wsf sample backs up a Group Policy object (GPO) to a specified backup directory. You can specify the GPO either by its name or by its GPO ID. The backup directory and the GPO must already exist. You can use the Comment parameter to specify an optional comment for the backup.
  56. Example: BackupGPO.wsf TestPolicyGPO \\server\share\GPOBackups /Comment: "Weekly backup" /Domain:example.microsoft.com
  57. Backing Up the GPOs in a Domain
  58. The BackupAllGPOs.wsf sample backs up all the GPOs in a domain to the specified backup directory. The backup directory must exist. You can use the Comment parameter to specify an optional comment for the backup.
  59. Example: BackupAllGPOs.wsf \\server\share\GPOBackups /Comment:"Weekly backup" /Domain:example.microsoft.com
  60. Creating a Copy of a GPO
  61. The CopyGPO.wsf sample creates a new GPO and copies the settings from a source GPO into the new destination GPO. You specify the source GPO either by its name or its GPO ID. You specify the new destination GPO by name. Use the MigrationTable switch to map security principals and paths across domains. Use the CopyACL switch to copy the access control list (ACL) on the source GPO to the destination GPO. To create a migration table, see the Create Migration Table script sample.
  62. Example: CopyGPO.wsf TestPolicyGPO NewProductionGPO /SourceDomain:example.microsoft.com /TargetDomain:example.microsoft.com
  63. Creating a New GPO
  64. The CreateGPO.wsf sample creates a GPO with the specified name in the specified domain.
  65. Usage: CreateGPO.wsf [/Domain:]
  66. Example: CreateGPO.wsf MyGPO /Domain:example.microsoft.com
  67. Creating a Policy Environment Using an XML File
  68. The CreateEnvironmentFromXML.wsf sample reads an XML file that specifies a policy environment, such as an organizational unit (OU) or a GPO.
  69. The script can perform operations such as the following:
  70.  
  71. Create GPOs and OUs
  72. Link GPOs
  73. Import settings into GPOs
  74. Set security on GPOs
  75. Create security groups and users
  76.  
  77. Using the Undo switch deletes the environment. Specify the ExcludeSettings switch to ignore the GPO templates specified in the XML. Specify the ExcludePermissions switch to ignore the permissions on scopes of management (SOMs) and on GPOs. Default permissions will be used instead. To use a migration table when you import GPOs, specify the MigrationTable switch and the path of the migration table file. Use the MigrationTable switch to map security principals and paths across domains. For more information about how to create a migration table, see the CreateMigrationTable.wsf script sample. Specify the Q switch to enable quiet mode, which suppresses all the confirmation warnings.
  78. Usage: CreateEnvironmentFromXML.wsf /xml: [/undo] [/Domain:] [/dc:] [/ExcludeSettings] [/ExcludePermissions] [/MigrationTable:]
  79. Example: CreateEnvironmentFromXML.wsf /xml:TestDomain.xml /Domain:/example.microsoft.com /dc:testdomaindc-1 /MigrationTable:TestMigrationTable.xml
  80. Creating an XML File that Represents a Policy Environment
  81. The CreateXMLFromEnvironment.wsf sample reads an existing policy environment; for example, OUs, GPOs, and GPO links. The sample script creates an XML file that represents that environment. You can use this script in conjunction with the CreateEnvironmentFromXML.wsf script. If you do not specify a domain, the domain of the computer is the default.
  82. Multiple switches are available for this script. Use the ExcludePermissions switch so that policy-related permissions are not recorded. Use the StartingOU switch to specify the Lightweight Directory Access Protocol (LDAP) path of an OU from which the XML should be built, rather than parsing the entire domain. Specify the IncludeUsers switch to include user accounts. Use the IncludeAllGroups switch to include groups from the Users container and from the domain root. If you do not specify the IncludeAllGroups switch, the script adds only the groups defined in the OUs to the XML file. If you specify a template path, the GPOs are exported to the specified location. Use the /TemplatePath switch to specify the location in which you want to store the backups of the GPO templates that contain the policy settings.
  83. Usage: CreateXMLFromEnvironment.wsf [/Domain:] [/dc:] [/TemplatePath:] [/StartingOU:] [/ExcludePermissions] [/IncludeAllGroups] [/IncludeUsers]
  84. Example: CreateXMLFromEnvironment.wsf TestDomain.xml /Domain:example.microsoft.com
  85. Example: CreateXMLFromEnvironment.wsf TestDomain.xml /StartingOU:OU=marketing,DC=MyDomain,DC=COM
  86. Example: CreateXMLFromEnvironment.wsf TestDomain.xml /templatepath:\backups
  87. Create Migration Table
  88. The CreateMigrationTable.wsf sample creates a file that contains the XML representation of the paths and the security principals for the specified GPO source.
  89. You can specify one of the following GPO sources:
  90. Then, you can use the resulting XML when you perform GPO import and copy operations, which are typically performed across domains.
  91. You can use the following switches:
  92.  
  93. Use the GPO switch to use a single GPO source when you build the XML migration table.
  94. Use the BackupLocation switch to use GPO backups as a source when you build the XML migration table.
  95. Use the AllGPOs switch to use all the GPOs in the domain as a source to build the XML migration table.
  96. Use the Overwrite switch to overwrite an existing XML file instead of appending to it.
  97. Use the MapByName switch to specify a corresponding account with the same name as the original in the destination domain.
  98.  
  99. Usage: CreateMigrationTable.wsf [/GPO:] [/BackupLocation:] [/AllGPOs] [/Overwrite] [/MapByName] [/Domain:]
  100. Example: CreateMigrationTable.wsf SampleTable.xml /BackupLocation:c:\GPOBackups /OverWrite /MapByName
  101. Example: CreateMigrationTable.wsf SampleTable.xml /GPO:TestGPO
  102. Example: CreateMigrationTable.wsf SampleTable.xml /AllGPOs /Overwrite /Domain:example.microsoft.com
  103. Deleting a GPO
  104. The DeleteGPO.wsf sample deletes a GPO. You can specify the GPO by name or by its GPO ID. If you do not specify the KeepLinks parameter, all the links to the GPO in the specified domain and in any sites are deleted.
  105. Usage: DeleteGPO.wsf [/KeepLinks] [/Domain:]
  106. Example: DeleteGPO.wsf MyGPO
  107. Grant Permissions for all GPOs in a Domain
  108. The GrantPermissionOnAllGPOs.wsf sample takes a particular domain and then grants a user or a group the specified level of permission for all the GPOs in that domain. This sample grants the specified level of permission regardless of whether those GPOs are linked to an OU or not. Use the Permission switch to specify a permission level of Read, Apply, Edit, FullEdit, or None for the security principal specified in the GroupName parameter. Use the Replace switch to remove existing permissions for the group or user before you make the change. If a group or a user is already granted a permission level that is higher than the new permission level, and you do not specify the Replace switch, no change is made.
  109. Consider the following example:
  110. In this example, if you do not use the Replace switch, the user retains the Full Edit permission because the change is not applied
  111. Usage: GrantPermissionOnAllGPOs.wsf /Permission: [/Replace] [/Domain:]
  112. Example: GrantPermissionOnAllGPOs.wsf "Marketing Group Administrators"/Permission:FullEdit /Replace
  113. Example: GrantPermissionOnAllGPOs.wsf TestUser /Permission:Read
  114. Importing a GPO
  115. The ImportGPO.wsf sample imports the settings from a backup GPO to another GPO that you specify. Use the BackupLocation parameter to specify the location of the backup. Then, use the BackupID parameter to specify the GPO name or backup ID (GUID) of the backup to use. If you do not specify a GPO, the name of the GPO that was backed up will be used.
  116. If you specify a GPO name or a GPO ID for the BackupID parameter, the script imports the most recent backup. To import an earlier version of a GPO backup, specify the unique backup ID for the backup. The unique backup ID is the string that uniquely identifies the backup within its backup directory. To retrieve the unique backup IDs for all the GPOs in a specific backup location, run the QueryBackupLocation.wsf script.
  117. Specify the GPO to which you are importing the setting by using the TargetGPO parameter. Use the optional MigrationTable switch when you import a GPO to map security principals and paths across domains. If the specified GPO does not exist, use the CreateIfNeeded switch to create a new GPO.
  118. Usage: ImportGPO.wsf [TargetGPO] [/MigrationTable:] [/CreateIfNeeded] [/Domain:]
  119. Example: ImportGPO.wsf f:\backup TestGPO NewGPO /CreateIfNeeded
  120. Example: ImportGPO.wsf f:\backup NewGPO /CreateIfNeeded
  121. Importing Multiple GPOs into a Domain
  122. The ImportAllGPOs.wsf sample creates new GPOs in a specified domain and imports settings into these new GPOs from a specified backup location. The script creates a new GPO and imports settings for the latest version of each backed-up GPO in the backup location. The names of the GPOs that were backed up are used for the new GPOs. The new GPOs are derived from a previous GPO backup. Therefore, if the previous GPOs still exist in the domain, they will be overwritten by the new GPOs. Any GPO settings that have been changed since the backup will be lost.
  123. Usage: ImportAllGPOs.wsf [/MigrationTable:] [Domain:]
  124. Example: ImportAllGPOs.wsf f:\backup /MigrationTable:f:\Table1.xml
  125. Restoring a GPO
  126. The RestoreGPO.wsf sample restores a backup GPO to the original domain from which it was saved. If the original domain is unavailable, the RestoreGPO.wsf sample fails. Use the BackupLocation parameter to specify the location of the backup. Then, use the BackupID parameter to specify the GPO name or the backup ID (GUID) of the backup to use.
  127. If you specify a GPO name or a GPO ID for the Backup parameter, the script restores the most recent backup. To restore an earlier version of a GPO backup, specify the unique backup ID for the backup. The unique backup ID is the string that uniquely identifies the backup in its backup directory. To retrieve the unique backup IDs for all the GPOs in a backup location, run the QueryBackupLocation.wsf script.
  128. Examples: RestoreGPO.wsf f:\backup BackUpGPO
  129. RestoreGPO.wsf f:\backup
  130. Restoring all GPOs in a Domain
  131. The RestoreAllGPOs.wsf sample restores the most recent backup of each GPO that is backed up to Active Directory in a specified backup location.
  132. Examples: RestoreAllGPOs.wsf f:\backup /Domain:example.microsoft.com
  133. Setting GPO Permissions
  134. The SetGPOPermissions.wsf sample takes a GPO name or GPO ID, group or user name, and permission level and grants that level of permission on the GPO. Use the Permission switch to specify a permission level of Read, Apply, Edit, FullEdit, or None for the security principal that is specified in the GroupName parameter. Use the Replace switch to remove the existing permissions for the group or user before you make the change. Otherwise, the script ensures that the group or user has at least the specified permission level.
  135. Example: SetGPOPermissions.wsf TestGPO TestGroup /Permission:Edit
  136. Example: SetGPOPermissions.wsf TestGPO TestGroup /Permission:Edit
  137. Example: SetGPOPermission.wsf TestUser /Permission:FullEdit /Replace /Domain:example.microsoft.com
  138. Setting Permissions for All GPOs Linked to a Scope of Management
  139. The SetGPOPermissionsBySOM.wsf sample grants a user or group a specified permission level for all the GPOs that are linked to a specified SOM (a site, a domain, or an OU). Use the Permission switch to specify a permission level of Read, Apply, Edit, FullEdit, or None for the security principal that is specified in the GroupName parameter. Use the Replace switch to remove existing permissions for the group or user before you make the change. If a group or a user has a permission level that is higher than the new permission level, and you do not specify the Replace switch, no change is made.
  140. Consider the following example:
  141. In this example, if you do not use the Replace switch, the user retains the Full Edit permission because the change is not applied. Use the Recursive switch to apply the change to all the child OUs of the specified SOM.
  142. Usage: SetGPOPermissionsBySOM.wsf /Permission: [/Recursive] [/Replace] [/Domain:]
  143. Example: SetGPOPermissionsBySOM.wsf "Marketing Group Administrators" "Marketing Group" /Permission:FullEdit /Recursive
  144. Example: SetGPOPermissionsBySOM.wsf MarketingOU TestUser /Permission:Read /Replace
  145. Setting Permissions to Create GPOs
  146. The SetGPOCreationPermissions.wsf sample grants or removes the permissions that let a user or security group create GPOs in a domain.
  147. Usage: SetGPOCreationPermissions.wsf [Remove] [/Domain:]
  148. Example: SetGPOCreationPermissions.wsf "Policy Administrators"
  149. Example: SetGPOCreationPermissions.wsf TestUser /remove
  150. Setting Policy-related Permissions on a SOM
  151. The SetSOMPermissions.wsf sample grants a user or group the specified level of permission on a specified SOM (a site, a domain, or an OU). Use the Permission switch to specify a permission level of LinkGPOs, RSoPLogging, RSoPPlanning, All, or None for the SOM. You can specify either the display name or the full LDAP path of the SOM for the SOM Name parameter. The Inherit switch causes all child containers to inherit the setting. RSoP planning mode requires, at least, a Windows Server domain controller to perform the query, and is not applicable to sites.
  152. Example: SetSOMPermissions.wsf "Test Marketing OU" "Marketing Admin Group" /Permission:All /Inherit
  153. Example: SetSOMPermission.wsf MarketingOU TestUser /Permission:LinkGPOs
  154. Listing All GPOs in a Domain
  155. The ListAllGPOs.wsf sample prints a list of all the GPOs in the specified domain.
  156. Using the /v switch creates detailed or verbose output for each GPO.
  157. Usage: ListAllGPOs.wsf [/v] [/Domain:]
  158. Example: ListAllGPOs.wsf /v /Domain:example.microsoft.com
  159. Listing Disabled GPOs
  160. The FindDisabledGPOs.wsf sample prints a list of all the GPOs that are disabled or partially disabled in the specified domain. This script enumerates both fully and partially disabled GPOs. The results are grouped accordingly.
  161. Usage: FindDisabledGPOs.wsf [/Domain:]
  162. Example: FindDisabledGPOs.wsf /Domain:example.microsoft.com
  163. Listing GPO Information
  164. The DumpGPOInfo.wsf sample prints information for a specified GPO. You can specify the GPO by its name or its GPO ID.
  165. Usage: DumpGPOInfo.wsf GPOName [/Domain:]
  166. Example: DumpGPOInfo.wsf MyGPO /Domain:example.microsoft.com
  167. Listing GPOs at a Backup Location
  168. The QueryBackupLocation.wsf sample prints a list of the GPOs that have been backed up to a specified file system location. For each backed-up GPO, the Verbose switch displays detailed information, such as the ID, the backup time, and any comments.
  169. Usage: QueryBackupLocation.wsf [/Verbose]
  170. Example: QueryBackupLocation.wsf \\server\share\GPOBackups /Verbose
  171. Listing GPOs by Policy Extension
  172. The FindGPOsByPolicyExtension.wsf sample prints a list of all the GPOs in the specified domain for which a specific policy extension is configured. For example, the script prints all the GPOs in the domain for which the Software Installation or Folder Redirection policy extensions are configured. You can specify either the GUID or the display name of the client-side extension. To determine which client-side extensions are registered locally, use the PrintCSE switch.
  173. Usage: FindGPOsByPolicyExtension.wsf [/PrintCSE] [/Domain:]
  174. Example: FindGPOsByPolicyExtension.wsf "Software Installation"
  175. This example lists all the GPOs that define policy settings for the 'Software Installation' policy extension.
  176. Example: FindGPOsByPolicyExtension.wsf /PrintCSE
  177. This example lists all CSEs that are installed locally.
  178. Listing GPOs by Security Group
  179. The FindGPOsBySecurityGroup.wsf sample prints a list of all the GPOs on which a security principal has the specified permission level. Use the Permission switch to specify the permission level (Read, Apply, Edit, or Full Edit) for the security principal that you want to find. If no permission is specified, the script queries for all the GPOs that have the Apply permission level. Use the Effective switch to display the GPOs with a specific set of permissions, whether the permissions are explicitly set or derived as a result of group membership. Use the None switch to display the GPOs that do not have the specified permission for the specified group or user.
  180. Usage: FindGPOsBySecurityGroup.wsf /Permission: [/Effective] [/Domain:] [/None]
  181. Example: FindGPOsBySecurityGroup.wsf "Domain Administrators" /Permission:Edit /Effective
  182. Listing GPOs orphaned in SYSVOL
  183. The FindOrphanGPOsInSYSVOL.wsf sample finds and then prints all the GPOs in SYSVOL that do not have a corresponding Active Directory source. These GPOs are usually referred to as orphaned GPOs.
  184. Usually, a GPO becomes orphaned through one of the following ways:
  185.  
  186. The GPO was deleted directly through ADSI Edit.
  187. The GPO was deleted by someone who had permissions to delete the GPO in Active Directory, but not in the SYSVOL directory.
  188.  
  189. In these cases, the Active Directory portion of the GPO is deleted, but the SYSVOL portion of the GPO remains. Use the Domain switch to specify a domain to search for orphaned GPOs.
  190. Usage: FindOrphanGPOsInSYSVOL.wsf [/Domain:]
  191. Example: FindOrphanGPOsInSYSVOL.wsf /Domain:example.microsoft.com
  192. Listing GPOs with Duplicate Names
  193. The FindDuplicateNamedGPOs.wsf sample prints a list of all the GPOs in the specified domain that have duplicate names.
  194. Usage: FindDuplicateNamedGPOs.wsf [/Domain:]
  195. Example: FindDuplicateNamedGPOs.wsf /domain:example.microsoft.com
  196. Listing GPOs Without Security Filtering
  197. The FindGPOsWithNoSecurityFiltering.wsf sample prints a list of all the GPOs for which apply permissions are not set. These GPOs exist, but they are not applied to any computers or users.
  198. Usage: FindGPOsWithNoSecurityFiltering.wsf [/Domain:]
  199. Example: FindGPOsWithNoSecurityFiltering.wsf /Domain:example.microsoft.com
  200. Listing SOM Information
  201. The DumpSOMInfo.wsf sample prints policy information about a specified SOM (a site, a domain, or an OU). The information that is printed includes information about the GPOs that are linked to the SOM and information about the policy permission on that SOM. Use the ShowInheritedLinks switch to show the inherited GPO links for the SOM.
  202. Usage: DumpSOMInfo.wsf [/ShowInherited] [/Domain:]
  203. Example: DumpSOMInfo.wsf "Test OU" /ShowInherited /Domain:example.microsoft.com
  204. Listing SOMs With Links to GPOs in External Domains
  205. The FindSOMsWithExternalGPOLinks.wsf sample prints a list of all the SOMs in the specified domain that link to a GPO in a different domain.
  206. Usage: FindsSOMsWithExternalGPOLinks.wsf [/Domain:]
  207. Example: FindsSOMsWithExternalGPOLinks.wsf /Domain:example.microsoft.com
  208. Listing Unlinked GPOs in a Domain
  209. The FindUnlinkedGPOs.wsf sample prints a list of all the GPOs in the specified domain that have no links. Links outside the domain, including site links, are not included in the list.
  210. Usage: FindUnlinkedGPOs.wsf [/Domain:]
  211. Example: FindUnlinkedGPOs.wsf /Domain:example.microsoft.com
  212. Printing the SOM Policy Tree
  213. The ListSOMPolicyTree.wsf sample prints a list of all the SOMs (all of the sites, domains, and OUs) in the specified domain. For each SOM in the list, a list of the GPOs that are linked to it is printed.
  214. Usage: ListSOMPolicyTree.wsf [/Domain:]
  215. Example: ListSOMPolicyTree.wsf /Domain:example.microsoft.com
  216. Generate Reports for all GPOs
  217. The GetReportsForAllGPOs.wsf sample generates two files for each GPO in the domain. The first file is an XML file that contains information such as details, links, security filtering, WMI filtering, delegation, computer, and user configurations for the GPO. The second file is an HTML representation of the GPO data. Use the ReportLocation parameter to specify the location in which you want to generate the files. Use the Domain switch to specify the domain that you want to run the report against.
  218. Usage: GetReportsForAllGPOs.wsf [/Domain:]
  219. Example: GetReportsForAllGPOs.wsf c:\reports
  220. Generate Reports for a GPO
  221. The GetReportsForGPO.wsf sample generates two files for a specified GPO or GPO ID in the domain. The first file is an XML file that contains information such as details, links, security filtering, WMI filtering, delegation, computer and user configurations for the GPO. The second file is an HTML representation of the GPO data. Use the ReportLocation parameter to specify the location in which you want to generate the files. Use the Domain switch to specify the domain that you want to run the report against.
  222. Example: GetReportsForGPO.wsf TestGPO c:\reports /Domain:test.microsoft.com
  223. Example: GetReportsForGPO.wsf c:\reports
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement