Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

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:

  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.

Comments

No comments.

Leave a Comment

Please register or log in to leave a comment.