This is actually part of a larger script but i taught it might be useful for some people.

basically place it in the root directory of your system or the root of the directory you want to check i.e. a users home directory run the script and it will output a CSV file with the results…

enjoy

 

*********************************************************************************************

$statuscheck = get-childitem -Recurse

Foreach ($s in $statuscheck)
{

    $access = $s | % {(get-date) – $_.LastAccessTime }
    if ($access.days -ge 2)
    {
    write-host $s.fullname
    write-host "File Was Last Accessed" $access.days "Days Ago"
    $s |format-table -property Fullname |out-file d:\results.csv -append
    }
   
}

 

*********************************************************************************************

Advertisements