Q. GPMC (Group Policy Management Console) includes a set of sample scripts to solve real-world administrative problems?

Jerold Schulman

October 1, 2006

2 Min Read
ITPro Today logo in a gray background | ITPro Today

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%GPMCscripts 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.

Example:

d:program filesGPMCscripts>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%GPMCscriptsGPMC.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%GPMCscripts folder contains:

BackupAllGPOs.wsfBackupGPO.wsfCopyGPO.wsfCreateEnvironmentFromXML.wsfCreateGPO.wsfCreateMigrationTable.wsfCreateXMLFromEnvironment.wsfDeleteGPO.wsfDumpGPOInfo.wsfDumpSOMInfo.wsfFindDisabledGPOs.wsfFindDuplicateNamedGPOs.wsfFindGPOsByPolicyExtension.wsfFindGPOsBySecurityGroup.wsfFindGPOsWithNoSecurityFiltering.wsfFindOrphanedGPOsInSYSVOL.wsfFindSOMsWithExternalGPOLinks.wsfFindUnlinkedGPOs.wsfGetReportsForAllGPOs.wsfGetReportsForGPO.wsfgpmc.chmGrantPermissionOnAllGPOs.wsfImportAllGPOs.wsfImportGPO.wsfLib_CommonGPMCFunctions.jsListAllGPOs.wsfListSOMPolicyTree.wsfQueryBackupLocation.wsfRestoreAllGPOs.wsfRestoreGPO.wsfSampleEnvironment.xmlSampleMigrationTable.migtableScriptingReadme.rtfSetGPOCreationPermissions.wsfSetGPOPermissions.wsfSetGPOPermissionsBySOM.wsfSetSOMPermissions.wsf


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like