Skip to content

Instantly share code, notes, and snippets.

@dstreefkerk
Created April 1, 2019 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstreefkerk/e1d8078603b38c28610c73fdf9cbe0a6 to your computer and use it in GitHub Desktop.
Save dstreefkerk/e1d8078603b38c28610c73fdf9cbe0a6 to your computer and use it in GitHub Desktop.
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