GPMC Scripting Samples Overview

" The Group Policy Management Console (GPMC) provides a comprehensive set of COM interfaces that can be used for scripting many of the operations supported by the console. Included with the GPMC are a set of sample scripts that make use of these interfaces.

The script samples can be found in the %programfiles%\GPMC\scripts folder after installing the GPMC.

The scripts included were written to solve real-world administrative problems and form the basis for a scripting toolkit useful to the Group Policy administrator. The scripts also serve to illustrate some of the key scripting objects and methods, and to provide an overview of the wide variety of tasks that can be accomplished with the GPMC.

The script samples are written in either VBscript or Jscript and are designed to be executed using Windows Script Host. All of the samples are intended to be executed from the command line. Because the sample scripts echo output to the command window, they should be executed using cscript.exe. If cscript.exe is not your default scripting host, you will need to explicitly specify cscript.exe on the command line.


d:\program files\GPMC\scripts>cscript ListAllGPOs.wsf

Note: you can run "cscript //H:cscript" from a command line to make cscript the default scripting host.

Executing a script with the '/?' switch will give the usage for that script.

Many of the sample scripts rely on a library of common helper functions that are contained in the file Lib_CommonGPMCFunctions.js. If you copy these scripts to another location, you must also copy this library file to that location for the script samples to work. For more information about the scripts included with the GPMC, see the SDK documentation included with this release.
The GPMC SDK documentation is located at %programfiles%\GPMC\scripts\GPMC.chm on any computer where you installed GPMC. It provides a detailed reference for all of the scriptable GPMC interfaces, as well as details about the individual scripts and additional technical information."

The %programfiles%\GPMC\scripts folder contains:

BackupAllGPOs.wsf                              BackupGPO.wsf                              CopyGPO.wsf                              CreateEnvironmentFromXML.wsf                              CreateGPO.wsf                              CreateMigrationTable.wsf                              CreateXMLFromEnvironment.wsf                              DeleteGPO.wsf                              DumpGPOInfo.wsf                              DumpSOMInfo.wsf                              FindDisabledGPOs.wsf                              FindDuplicateNamedGPOs.wsf                              FindGPOsByPolicyExtension.wsf                              FindGPOsBySecurityGroup.wsf                              FindGPOsWithNoSecurityFiltering.wsf                              FindOrphanedGPOsInSYSVOL.wsf                              FindSOMsWithExternalGPOLinks.wsf                              FindUnlinkedGPOs.wsf                              GetReportsForAllGPOs.wsf                              GetReportsForGPO.wsf                              gpmc.chm                              GrantPermissionOnAllGPOs.wsf                              ImportAllGPOs.wsf                              ImportGPO.wsf                              Lib_CommonGPMCFunctions.js                              ListAllGPOs.wsf                              ListSOMPolicyTree.wsf                              QueryBackupLocation.wsf                              RestoreAllGPOs.wsf                              RestoreGPO.wsf                              SampleEnvironment.xml                              SampleMigrationTable.migtable                              ScriptingReadme.rtf                              SetGPOCreationPermissions.wsf                              SetGPOPermissions.wsf                              SetGPOPermissionsBySOM.wsf                              SetSOMPermissions.wsf