Welcome to TechNet Blogs Sign in | Join | Help

Syndication

News

  • My Twitter
  • PowerShell and Group Policy Administration

    Did you know that you can use PowerShell scripting to enhance the Group Policy administration? Me neither until I read the nice article "Simplifying Group Policy Administration with Windows PowerShell"

    In this article you will discover how to use the GPMC API's to manage the GPO through Windows PowerShell. There is one example that really shows the power of PowerShell scripting. If you use that script, which I included below, you will have all GPO's that have been changed in the past 24 hours. Imagine how you should to this today with the tools you have available?

    $gpmSearchCriteria = $gpm.CreateSearchCriteria()
    # We want all GPOs so no search criteria will be specified
    $gpmAllGpos = $gpmDomain.SearchGPOs($gpmSearchCriteria)
    # Find all GPOs in the domain
    foreach ($gpmGpo in $gpmAllGpos)
    {
    if ($gpmGpo.ModificationTime -ge (get-date).AddDays(-1)) {$gpmGpo.DisplayName}
    # Check if the GPO has been modified less than 24 hours from now
    }

    This example script together with other scripts is available as a download

    Published Saturday, May 26, 2007 7:19 AM by aralves

    Filed under:

    Comment Notification

    If you would like to receive an email when updates are made to this post, please register here

    Subscribe to this post's comments using RSS

    Comments

    No Comments

    Leave a Comment

    (required) 
    required 
    (required) 

      
    Enter Code Here: Required
    © 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement  
    Page view tracker