Group Policy Blog

Group Policy Tips, Tricks, and News from Darren Mar-Elia

Getting Group Policy Counts with PowerShell

Sometimes you want to know how many GPOs you have in a domain. Powershell provides a way to do this quickly and easily. Earlier today I tweeted about the way to do this in Windows 7 or Server 2008-R2, using the Microsoft-provided “GroupPolicy” PowerShell Module. Its as simple as:

(Get-GPO -All).Count

However, if you are not yet on these newer OS versions, you can still get this information from PowerShell. Specifically, my free PowerShell GPMC cmdlets provide nearly identical syntax to the MS ones, but on earlier versions of the OS (i.e. 2008, XP and 2003). The syntax is:

(get-sdmGPO *).Count

Quick, and easy!


There are 3 comments .

Kash Adhvaryu —

I ran the command on Windows 2008 R2 with Administrative privileges, and I get error message stating The term Get-GPO is not recognized as the name of cmdlet. Any suggestions?

Reply »
Kash Adhvaryu —

This is the exact error:
PS C:\Personal> (get-sdmGPO *).Count
The term ‘get-sdmGPO’ is not recognized as the name of a cmdlet, function, scri
pt file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:12
+ (get-sdmGPO <<<< *).Count
+ CategoryInfo : ObjectNotFound: (get-sdmGPO:String) [], CommandN
+ FullyQualifiedErrorId : CommandNotFoundException

Reply »

Share Your Thoughts!


Copyright © 2015 SDM Software, Inc.
Site design by Social Media Ninjas