We help IT Professionals succeed at work.

Determining the number of group policies

Simon336697
Simon336697 asked
on
Dear Everyone, hope you are all well and and can help.

Guys we have a 2003 AD domain.

What I want to do is to:

1) Determine by script, how many group policies we have
2) Determine how many of those are active (that is, not disabled)
3) Determine how many of those are inactive (that is, disabled)

Any help greatly appreciated.
Comment
Watch Question

Senior Active Directory Engineer
Top Expert 2012
Commented:
You cannot add simply any attribute within ADUC to be able to modify it. It requires some programming stuff :/ and DLL rebuilding (if you ask if I can - no I can't :) )

There is only one way, you can do this simply and painless. You need appropriately written VBScript and you can add context menu on user's object using ADSIEdit. When you click right mouse button on a user then you will see that option which executes script. This would be something similar to EmployeeID example on Mike's blog at
http://adisfun.blogspot.com/2009/05/add-employee-id-field-aduc.html

and you can also add extra column to display (read-only mode) in ADUC when browsing users. You can also do that using ADSIEdit. Some short example at http://pberblog.com/post/2009/06/21/Add-extra-columns-to-Active-Directory-Users-and-Computers-display.aspx

Remember, do those changes in test environment to make sure that it works fine for you then implement theme in production

Regards,
Krzysztof
Krzysztof PytkoSenior Active Directory Engineer
Top Expert 2012

Commented:
I'm sorry - wrong window :) answer for your question will be post soon ;)

Krzysztof
Krzysztof PytkoSenior Active Directory Engineer
Top Expert 2012

Commented:
I think you may be interested in PowerShell's Get-GPO cmd-let.
http://technet.microsoft.com/en-us/library/ee461059.aspx

You need to run it on 2008R2 DC or workstations with RSAT Tools installed (first, you need to import GPO module for PS)
http://technet.microsoft.com/en-us/library/ee461027.aspx

then you can  try with

Number of GPOs

 
Clear-Host

$i=0

Get-GPO -All | %{ $i=$i+1 }

Write-Host "Total GPOs: "$i

Open in new window


For other questions, see MS Technet forum at
http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/de1431b6-190c-4779-8b44-b2c33b22fc15/

Krzysztof

Author

Commented:
Thanks everyone.
Sorry about the belated delay.
I wish you all a very happy Christmas and best new year for all of you.