Breadth First Search in PowerShell

One of the things that a customer does every couple months in IT is moving one folder into another. Usually, they don’t know or even realize that they have moved it until the next time they (or someone else) need it. It can be hard to find it when there are a dozen other folders they could have moved it too but this problem is compounded when there are thousands of folders.

I have been messing with PowerShell the last couple weeks in preparation for using PowerCLI to manage our VMware cluster. This was one of the scripts I worked through to help me learn it (the others are suited for print). That being said PowerShell is crazy like perl in how a complex script can be written in two lines so there’s most likely a simpler way to write this. If there is by all means let me know in the comments.
Continue reading