Announcement

Collapse
No announcement yet.

Query AD for certain policies - Get-GPO

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Query AD for certain policies - Get-GPO

    Hello,
    Very new to powershell and I think this script will work. I am trying to search GPO's for certain policies that have been enabled. Yet when I run this on my 2008 DC with Group Policy management running I get the error "Get-Gpo is not recognized as the name of a cmdlet". Being real green here, do you have any suggestions?

    Script:
    $count = 0
    (Get-GPO -all) | % {
    "Checking " + $_.displayname
    $a = Get-GPRegistryValue -guid $_.ID -key "HKLM\Software\Policies\Microsoft\Windows\WindowsU pdate" -valuename "WUServer"
    if ($a.policystate -eq "Set") {
    $count++
    "GPO Matches --"
    $a
    }
    }
    "Total matches: " + $count

  • #2
    Re: Query AD for certain policies - Get-GPO

    Have you installed Powershell v2? Or is your DC Windows 2008 R2?
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment

    Working...
    X