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 2014/09/30 08:00AM

PowerShell for the Easily Frustrated N00b, or, “A Simple and Useful Command”

By Jen McCown, 2011/09/15

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:

  1. Start > Run > “PowerShell”
  2. cd “\\myUNC\users\jen\My Documents”
  3. 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.)
  4. 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….

Happy days,
Jen McCown
http://www.MidnightDBA.com/Jen

Learn more about PowerShell from my husband Sean on his blog, DBARant , and also through his POSH tutorials on MidnightDBA.com.


Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.