Summary: Microsoft PowerShell MVP and honorary Scripting Guy Sean Kearney continues with part two his five-part holiday series.
Microsoft Scripting Guy, Ed Wilson, is here. Today we have part two of a five-part series of It’s a Wonderful Shell staring George Shelley. These are written by Windows PowerShell MVP Sean Kearney. For more information about the series, Sean’s biography, and a link to the series video teaser, see the Scripting Guys Announce the Holiday Lineup blog post.
It’s a Wonderful Shell—Chapter 2
And so, Clarence Scripto sat down with his good friend George.
“You honestly believe people here at the office would have been better off without your being around?”
George was stubborn. “Come on. Look at the mess I’ve made of things today alone. Why those files that were lost on that laptop … years of data gone. I should have known better, too. Why I’m a complete screw up!”
Clarence put on a pot of Mint tea to settle the air. The mint was particularly refreshing. Even our little cricket friend popped over to grab a sniff, now feeling a little less grumpy himself. Mint tea is always good to settle the nerves, even for Shiminy Cricket.
Clarence poured a small thimble for the cricket as he continued to chat with George.
“Ok fine. You think you’ve done no good. Let’s remind you of another soul you helped out in the company. Do you remember the co-op student we had six months ago? What was his name?”
George Shelley shook his head. “What? Henry Stack?! How did I help that kid out? In our high school co-op program, all I could ever hand to him were lousy tasks like disassembling 40-gig IDE hard drives and despooling over one hundred DLT tapes for destruction. How did I help HIM?!”
Clarence paused. “And did that young man ever ask about Windows PowerShell?”
George nodded. “Long ago he asked how we could search for hidden files with Windows PowerShell easily. He knew in the old world of command prompt he could do something like this to find all folders with the name ‘Music’ in them and then list them out on the screen.”
DIR /s /ah /b | find /i “*music*”
“… But he was curious whether Windows PowerShell could do the same thing. You showed him this line in Windows Powershell that produced the same output.”
GET-CHILDITEM –recurse –Attributes Hidden –include *Music*.* | Select-Object FullName
“Remember his first reaction,George?”
George Shelley remembered that day. “The young fellow was interested in how I typed the line so quickly even although there was more information at hand.”
“That’s right, George, you showed him the auto completion features of the Windows PowerShell console. How after hitting the hyphen and hitting the Tab key multiple times, it would auto fill with available parameter names.”
That was true. Henry was impressed with that.
“Then,” started Clarence, “moments later, you showed him some of the things that were EASIER in Windows PowerShell. When you took the output and ran it through a GET-MEMBER cmdlet.
GET-CHILDITEM –recurse –Attributes Hidden –include *Music*.* | Select-Object FullName | GET-MEMBER
“You showed that young man there were many ways to manipulate and export the data from that same line—like outputting the information to a CSV file for Excel to work with.”
GET-CHILDITEM –recurse –Attributes Hidden –include *Music*.* | Select-Object FullName | EXPORT-CSV C:\MusicFolder.csv
“ … Or, to show the information such as the time the file was last written, along with the folder name.”
GET-CHILDITEM –recurse –Attributes Hidden –include *Music*.* | Format-Table Name,LastWriteTime
“…You even spent a few minutes showing him easy ways to sort that information out by using SORT-OBJECT.”
GET-CHILDITEM –recurse –Attributes Hidden –include *Music*.* | SORT-Object LastWriteTime | Format-Table Name,LastWriteTime
George still didn’t get it. This is all seemed so common place to him. Windows PowerShell was just a tool he used daily. How was it life-changing for that kid?”
Clarence paused. “George, do you remember what happened to Henry after he left the company?”
George looked down and smiled. “He applied for a job. They asked me for a reference, and I gave him a good one. He never complained, took all those lousy tasks, and STILL loved technology afterwards.”
A nod from his friend the developer came across. “That young kid got a job straight out of high school because of you. To this day, he uses Windows PowerShell at work to help find lost customer files and data. Something so simple that his co-workers couldn’t do. George, my friend, your small knowledge helped a kid get a job.”
That did bring a smile to George.
“Here my friend, the Mint tea is ready. Let’s grab some cookies and chat a bit more.”
Thanks, Sean … join us tomorrow as we continue with It’s a Wonderful Shell—Chapter 3.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy