How to Find Files by Owner with or without PowerShell


Native Auditing vs. Netwrix Auditor for Windows File Servers

We never share your data. Privacy Policy
Native Auditing Netwrix Auditor for Windows File Servers
Steps
  1. Open the PowerShell ISE → Run the following script on the workstation, specifying the network path of a file share or file system, the file owner’s name and the file path for export to csv:

    [String]$username = "enterprise\t.simpson"
    [String]$username = "enterprise\t.simpson"
    [String]$outfile = "C:\scripts\searchowner.csv"
    $path = Get-ChildItem "\\pdc\shared\HR" -Recurse
    Foreach( $file in $path ) {
      $f = Get-Acl $file.FullName
      if( $f.Owner -eq $username ) {
        Write-Host( "{0}"-f $file.FullName | Out-File `
          -Encoding "UTF8" `
          -FilePath $outfile -Append)
      }
    }

  2. Open the file produced by the script in MS Excel.


Sample report:
Find files and folders by owner report produced by PowerShell script

  1. Run Netwrix Auditor → Navigate to "Reports" → Expand the "File Servers" section → Go to "File Servers – State-in-Time" → Select "Files and Folders by Owner" → Click "View".
  2. Specify the "Object UNC Path" and "Owner" options.
  3. To export the report to CSV or another format, click the "Export" button → Choose a format from the dropdown menu → Click "Save".


Sample report:
Files and Folders by Owner Netwrix Auditor report: shows files and folders inside the share, grouped by owner

Easily Find Files by Owner on Your File Server and Automate Other Routine Tasks

IT pros often have to perform routine file management tasks. For example, when an employee leaves the company, they need to find all the files owned by that specific user in situations so they can move, delete or change the owner of those files. With manual methods, these tasks take a lot of time, so you might want to automate them with Windows PowerShell scripts. For instance, the PowerShell script provided above enables you to find all files on a share or in a specified folder that have a particular owner in their ACL by using the Get-ChildItem and Get-Acl cmdlets. However, even with this script, generating the output file can take a lot of time if there are many files to parse on your file server.

Would you rather just open a prebuilt report with a list of all the files that belong to a specific owner? Try Netwrix Auditor for Windows File Servers. It’s easier — and faster — to pull the data you need; just specify the file owner and path. Moreover, you can specify multiple owners or pull data from a particular moment in the past. Of course, Netwrix Auditor does a lot more than report on file ownership. For instance, it also reports on changes made to files, folders, shares and permissions; delivers visibility into effective permissions, duplicate and stale data, and data volumes; and alerts you about critical events, such as modification of large number of files in a short period of time. No matter what you want to report on, you’ll save time with its predefined and custom reports, flexible filtering and exporting options, and report subscriptions.