# Search All drives

**URL:** <https://forums.powershell.org/t/search-all-drives/26506>\
**Category:** Uncategorized\
**Created:** [July 14, 2026, 11:29pm UTC](https://forums.powershell.org/t/search-all-drives/26506 "2026-07-14T23:29:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jctech2025](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jctech2025](https://forums.powershell.org/u/jctech2025)\
**Post date:** [July 14, 2026, 11:29pm UTC](https://forums.powershell.org/t/search-all-drives/26506/1 "2026-07-14T23:29:47Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 15, 2026, 12:37am UTC](https://forums.powershell.org/t/search-all-drives/26506/2 "2026-07-15T00:37:32Z")

</div>

> [@jctech2025](#):
>
> Thoughts?

Have you tried to search for a solution? 🤔 🤷‍♂️

> [@jctech2025](#):
>
> Problem is I can’t figure out how to include any additional drives.

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'`.

---

<div class="post-metadata">

**Author:** ![vern\_anderson](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/vern_anderson/32/5140_2.png) [@vern\_anderson](https://forums.powershell.org/u/vern_anderson)\
**Post date:** [July 15, 2026, 12:56pm UTC](https://forums.powershell.org/t/search-all-drives/26506/3 "2026-07-15T12:56:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Christophe](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@Christophe](https://forums.powershell.org/u/Christophe)\
**Post date:** [July 29, 2026, 3:04pm UTC](https://forums.powershell.org/t/search-all-drives/26506/4 "2026-07-29T15:04:12Z")

</div>

To get all logical disk, you can use

```powershell
get-ciminstance -class win32_logicaldisk | foreach { Get-ChildItem "$($_.Name)\" -Filter *.txt -Recurse }

```

If you want to scan only local disk, you can add a where clause.

```powershell
get-ciminstance -class win32_logicaldisk | where { $_.DriveType -eq 3 } | foreach { Get-ChildItem "$($_.Name)\" -Filter *.txt -Recurse }

```

If you want to scan only network drive, you can change the where clause.

```powershell
get-ciminstance -class win32_logicaldisk | where { $_.DriveType -eq 4 } | foreach { Get-ChildItem "$($_.Name)\" -Filter *.txt -Recurse }

```

An other solution to get logical disk is :

```powershell
get-ciminstance -query "select * from win32_logicaldisk where DriveType -eq 4" | foreach { Get-ChildItem "$($_.Name)\" -Filter *.txt -Recurse }

```

The difference is

1. in the first solution (-class…), WMI returns all results and the pipeline applies the filter with where
2. in the second one (-query), WMI returns directly filtered results.

With logicaldisk, this is not significant but for others classes with many instances, it is more optimized to use -query.

Example on my Windows 10 Workstation :

```powershell
$arrServices = get-ciminstance -query "select * from win32_service"
write-host "count : $($arrServices.count)
353

$arrServices = get-ciminstance -query "select * from win32_service name like 'win%'"
write-host "count : $($arrServices.count)
4

```

---

<div class="post-metadata">

**Author:** ![jctech2025](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@jctech2025](https://forums.powershell.org/u/jctech2025)\
**Post date:** [July 29, 2026, 11:26pm UTC](https://forums.powershell.org/t/search-all-drives/26506/5 "2026-07-29T23:26:10Z")

</div>

Thanks for this info. I’m going to try all this for my script.

---

<div class="post-metadata">

**Author:** ![genXdev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/genxdev/32/6185_2.png) [@genXdev](https://forums.powershell.org/u/genXdev)\
**Post date:** [August 14, 2026, 5:13pm UTC](https://forums.powershell.org/t/search-all-drives/26506/6 "2026-08-14T17:13:06Z")

</div>

I wrote a pretty good cmdlet for this.

[https://github.com/genXdev/GenXdev.PowerShell/blob/main/Docs/en-US/Find-Item.md](https://github.com/genXdev/GenXdev.PowerShell/blob/main/Docs/en-US/Find-Item.md)

---

<div class="post-metadata">

**Author:** ![genXdev](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/genxdev/32/6185_2.png) [@genXdev](https://forums.powershell.org/u/genXdev)\
**Post date:** [August 19, 2026, 10:36am UTC](https://forums.powershell.org/t/search-all-drives/26506/7 "2026-08-19T10:36:40Z")

</div>

[![](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/9/97b1776a6bc05e5732875c913a916bbf68f30ad8.jpeg "Introduction to Find-Item") ](https://www.youtube.com/watch?v=iJSb1bEZR94)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [September 18, 2026, 10:37am UTC](https://forums.powershell.org/t/search-all-drives/26506/8 "2026-09-18T10:37:17Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
