http://www.sqlservercentral.com/blogs/sql_awesomesauce/2011/09/15/powershell-for-the-easily-frustrated-n00b_2C00_-or_2C00_-_1C20_a-simple-and-useful-command_1D20_/ Printed 2016/12/10 04:09AM
PowerShell for the Easily Frustrated N00b, or, “A Simple and Useful Command”
The stupid, stupid Windows search (Start Menu > Search) doesn’t work on one of my computers (running WinXP Pro). Yes, I made sure to add the network location that holds my files, and yes, I rebuilt the file index. The damn thing still ignores everything and claims I don’t have any files, anywhere.
Powershell to the rescue!
Yes, this is a very, VERY simple application of PowerShell, but today it came in insanely useful, and hey….I’m still a POSH n00b, okay? #Defensive
Here’s what I did:
- Start > Run > “PowerShell”
- cd “\\myUNC\users\jen\My Documents”
- Get-help dir
(…to get help on the command, because I forgot what parameters I needed. “dir” is an alias for “Get-ChildItem”, the true POSH cmdlet.)
- Get-ChildItem -Filter *restore*.sql –Recurse (this searches the directory and all subdirectories for all .SQL files with “restore” in the name).
Oh, THERE’S that stupid file….
Learn more about PowerShell from my husband Sean on his blog, DBARant , and also through his POSH tutorials on MidnightDBA.com.