How to get a list of all GPOs linked to an ADComputer

Welcome Forums General PowerShell Q&A How to get a list of all GPOs linked to an ADComputer

This topic contains 4 replies, has 4 voices, and was last updated by

1 year, 3 months ago.

  • Author
  • #67920

    Points: 0
    Rank: Member

    Quick question

    I'm trying to get all gpos that a Computer member of

    I am trying

    $Computers = (Get-ADComputer -Filter * | Select -Expand Name)
    Get-GPResultantSetOfPolicy -Computer $Computers -ReportType HTML -path"Filepath"

    But gives me error: Can't convert "System Object[]" to the type 'System.String'

  • #67921

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    $computers contains more than one name; -Computer only accepts one name. You'll need to use a ForEach loop.

    Get-ADComputer -Filter * | 
    Select -Expand Name |
    ForEach { 
     Get-GPResultantSetOfPolicy -Computer $_ -ReportType HTML -path "$($_).html"

    That'll generate an HTML apiece, if I mangled the syntax correctly.

    • #67924

      Points: 0
      Rank: Member

      where it's gonna save the html report ?


    • #87100

      Points: 1
      Rank: Member

      I see the below error on some of the servers.

      "Get-GPResultantSetOfPolicy : The Resultant Set of Policy (RSoP) report cannot be generated for user domain\Harish on the MYPC99 computer because there is no RSoP logging data for that user on that computer. This could be because the user has never logged onto that computer."

      I haven't logged in to the error servers even once. its only giving me the results from the servers which I have logged in at least one time before.

  • #67941

    Points: 62
    Rank: Member

    The -path parameter specifies the output path and in Don's example he's just using the current pipeline value which should be just the computer name so it will output a single html file named for each computer name in the current working location for your console session.

    Get-ChildItem .\*.html | foreach {Invoke-Item $_.fullname}

    That will open all html files in the current directory from your console.

The topic ‘How to get a list of all GPOs linked to an ADComputer’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort