List of Files

I’m trying to develop a powershell script so that I can run it and get an output of all files with a specific extension on a system. Everything I’ve tried only works if I give it a specific directory to search in, but I want a list of every single one on the computer. Is there a specific command set I should be looking at?

# Replace 'txt' with your extension
Get-ChildItem -Path \path\to\search -Filter *.txt -Recurse

So yeah. That’s essentially what I had, and It seemed to me like it wasn’t working unless I gave it a specific path. After playing with it more, I realize it’s because the file i’m trying to find is in an appdata folder which is hidden. So I added the -hidden switch but then I just get access errors saying “Access to the path C:\this\path\here” is denied.

An interesting thing is that i’ve noticed if I set the path to a specific appdata folder, it will pick up the .OST file (the filetype i’m trying to locate on some systems) when i’m NOT using the -Hidden switch, but as soon as I add that switch in, i get those access errors and no output. is there still something i’m missing on this command?

Thanks for your help.