Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using PowerShell how can I count the number of files that each owner has modified in the last 45 days?

This is how I am able to get counts by extension in the last 45 days:

gci -Recurse| where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)}| group Extension -NoElement

Instead of grouping by extension, I would like to group and count by owner. Thank you for your guidance!

Please note that this is counting through an entire directory structure

share|improve this question
gci -recurse | where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)} | % { get-acl $_ } | group Owner -NoElement

Will get you all the permissions, grouped by owner. Just remove the last pipe if you want them ungrouped.

i.e:

gci -recurse | where {$_.LastWriteTime -gt (Get-Date).AddDays(-45)} | % { get-acl $_ }
share|improve this answer
    
thanks so much! now can i ask you, how can i run this script once for every directory in a parent directory. for example if i am in parent\, and parent dir has dir a, dir b, dir c, i want to run it once for each of those dirs? – l--''''''---------'''''''''''' Feb 1 '13 at 20:35
    
and is there a way for it to not display details on every file, only the summary? – l--''''''---------'''''''''''' Feb 1 '13 at 20:40
    
Setting -recursive on gci already runs it for all directories. If you only want to run it for one specific parent directory, just set the name of that dir. e.g: gci nameOfDir -recurse |... If you want to see the count of how many items are owned by a specific owner, just use the first script (I assume that's what you mean by "Summary") – malgca Feb 1 '13 at 21:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .