Search All drives

Hi All,

Been a while since I posted here. I’m trying to do a search for a file. Instead of getting only results from the C: drive I’m trying to include usb and mapped drives as well. So far I’ve only gotten get-childitem -Path C:\ -Filter *$searchedobject*. Problem is I can’t figure out how to include any additional drives. Thoughts?

Thanks,

Have you tried to search for a solution? :thinking: :man_shrugging:

In the simplest case you can use Get-PSDrive to list all available drives. And to narrow it down to the ones with filesystems on it you can use Get-PSDrive -PSProvider 'FileSystem'.

1 Like

Get-PSDrive -PSProvider FileSystem | ForEach-Object {Get-ChildItem $_.Root -Filter *.txt -Recurse}