SynopsisFinds files on a remote computer.
- Find-File [-FileName] [-StartPath] [-ComputerName] [-Credential]
DescriptionFind-File is used to find files across the local drives of a remote computer. File names can be specified using wildcards and searches narrowed by using the StartPath parameter.
File searches are performed by filename only. Increasing the accuracy of the file name by removing wildcards and providing file extensions shortens search time and reduces load on the searching computer.
- FileName The file name to search for. File names may contain wildcards.
- StartPath The path from which to start the search.
- ComputerName The computer that will run the search.
- Credential The credentials used to perform the search. Results will only be shown for files for which the executing user has rights.
InputsFind-File accepts pipeline input for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.
OutputsFind-File returns a Vexasoft.FileInfo object for each matched file on the target computer.
NotesThe cmdlet requires that the Remote Registry and RPC services are started on the computer it is trying to access and that DNS services are available to resolve target host names.
Example 1This command will find all files named install.log on remote computer PC01:
c:\PS>Find-File install.log -ComputerName PC01
Example 2Wildcards can be used in searches. This command will find all files with the extension "log" on remote computer PC01:
c:\PS>Find-File *.log -ComputerName PC01
Example 3The StartPath parameter can be used to limit results and speed up the search. This command will find all files with the extension "log" in c:\windows\temp and all subdirectories on remote computer PC01.
c:\PS>Find-File *.log -StartPath c:\windows\temp -ComputerName PC01
Example 4The StartPath parameter does not need to be specific to a particular drive. This command will find all files with the extension "log" in the Users directory and all subdirectories across all drives on remote computer Server01.
c:\PS>Find-File *.log -StartPath \Users -ComputerName Server01