none
GPO Report OU Level RRS feed

  • Question

  • Hello Guys,

    I know that Get-GPOReport generates xml/htl report for a particular GPO or for GPOs in a domain.

    How can I generate a report for all GPOs in a particular OU.

    I tried :
    ===================================================================
    Import-Module ActiveDirectory
    import-module GroupPolicy 

    $LinkedGPOs = Get-ADOrganizationalUnit -Filter 'Name -like "*servers_w2k12*"' | select -ExpandProperty LinkedGroupPolicyObjects

    $GUIDRegex = "{[a-zA-Z0-9]{8}[-][a-zA-Z0-9]{4}[-][a-zA-Z0-9]{4}[-][a-zA-Z0-9]{4}[-][a-zA-Z0-9]{12}}"

    foreach($LinkedGPO in $LinkedGPOs)
    {           
        $result = [Regex]::Match($LinkedGPO,$GUIDRegex);           
        if($result.Success)
     {           
            $GPOGuid = $result.Value.TrimStart("{").TrimEnd("}")
                                   
        }           
     Get-GPOReport -Guid $GPOGuid ReportType Html -Path C:\Temp\GPO.html
    }
    =======================================================================
    But I get report only with the first GPO. How can append in this case. Or how can I generate a report for all GPOs in a particular OU.

    Thanks in advance,
    Subhash

    Tuesday, July 14, 2015 4:21 PM

Answers

  • Hi,

    Otherwise you can make these changes on the last part to have a single report.

    $Report += Get-GPOReport -Guid $GPOGuid ReportType Html
     }
    
    $Report  | Out-File C:\Temp\GPO.html
     =======================================================================


    Regards,

    Satyajit

    Please “Vote As Helpful” if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

    Friday, July 17, 2015 12:59 PM

All replies

  • Hi Subhash,

    When you are running this cmdlet alone, how many object its returning.

    Get-ADOrganizationalUnit -Filter 'Name -like "*servers_w2k12*"' | select -ExpandProperty LinkedGroupPolicyObjects

    Secondly your output command seems like overwriting the file.

    Try changing it to this.

    Get-GPOReport -Guid $GPOGuid ReportType Html -Path "C:\Temp\GPO-$GPOGuid.html"


    Regards,

    Satyajit

    Please“Vote As Helpful” if you find my contribution useful or “MarkAs Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.


    Friday, July 17, 2015 11:43 AM
  • Hi,

    Otherwise you can make these changes on the last part to have a single report.

    $Report += Get-GPOReport -Guid $GPOGuid ReportType Html
     }
    
    $Report  | Out-File C:\Temp\GPO.html
     =======================================================================


    Regards,

    Satyajit

    Please “Vote As Helpful” if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

    Friday, July 17, 2015 12:59 PM
  • It worked...Super....

    Thanks Satyajit.

    Tuesday, July 28, 2015 11:38 AM