Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get a count of GPOs created per year
Import-Module GroupPolicy
$gpos = Get-GPO -All | Select-Object DisplayName,Description,CreationTime,DomainName
$gpos | Select-Object *,@{n='Year';e={$_.CreationTime | Get-Date -Format 'yyyy'}} | Group-Object -Property Year | Select-Object -Property @{n='Year';e={$_.Name}},@{n='Quantity';e={$_.Count}} | Format-Table -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.