How to Find a File and Check If It Exists

Native Auditing vs. Netwrix Auditor for Windows File Servers

We never share your data. Privacy Policy
Native Auditing Netwrix Auditor for Windows File Servers
  1. Open the PowerShell ISE → Create a new script using the following code:

    $filename = '*payroll*.*'#you can use wildcards here for name and for extension
    $searchinfolder = '\\pdc\Shared\Accounting*'
    Get-ChildItem -Path $searchinfolder -Filter $filename -Recurse | %{$_.FullName}

  2. Specify the name of file in question ($filename) and directory or folder ($searchinfolder) to search in.
  3. Run the script.
  4. Review the results:

Powershell find file report

  1. Run Netwrix Auditor → Navigate to "Reports" → Open "User Behavior and Blind Spot Analysis" → Go to "Information Disclosure" → Select "File Names Containing Sensitive Data" → Click "View".
  2. Specify the following filters and parameters:
    • Object UNC Path – Specify the path to your file share (example: "\\server\share")
    • Disallowed Words – Specify the name of the file you want to search (example: "payroll")
  3. Click "View Report".

To save the report, click the "Export" button → Select a format, such as PDF → Click "Save as" → Choose a location to save it.

Netwrix Auditor File Names Containing Sensitive Data: shows files with names that suggest they contain sensitive data

Browse for a File With PowerShell and Find Its Full Path

IT pros often have to perform routine file management tasks such as finding data and then moving or deleting it. With manual methods, these tasks take up a lot of time, so you might want to automate them with Windows PowerShell scripts and commands. For instance, the PowerShell script provided above enables you to find all files on your share that have a particular word in their name by using the Get-ChildItem cmdlet.

Would you rather just open a prebuilt report to check if file exists inside the folder? Try Netwrix Auditor for Windows File Servers. It’s easier — and you’ll get a lot more data. In addition to the object paths, you’ll see the file ownership details, the activity trail around the files and the user access permissions.