It’s a Wonderful Shell—Chapter 5

It’s a Wonderful Shell—Chapter 5

  • Comments 2
  • Likes

Summary: Microsoft PowerShell MVP and honorary Scripting Guy Sean Kearney continues with part 5 his five-part holiday series.

Microsoft Scripting Guy, Ed Wilson, is here. Today we have part five 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.

Image of George Shelley

It’s a Wonderful Shell—Chapter 5

They sat back and looked at each other. George and his best friend, the developer, Clarence.

“Think about it, George. With Windows Powershell you saved many of us from quitting, recovered contracts, and brightened the lives of every new staff member with such simple and effective ideas. Why, a kid got himself a job doing what he LOVED, doing it all because of your simple love for Windows PowerShell and your joy to share.”

George didn’t know what to say.

“How could you want to leave us? We would miss you more than a baby would miss playing with crinkly paper, more than a cat would miss pouncing on a Laser. Why even more than a puppy would missing drinking from the toi ….”

Before he could respond, voices came shouting down the hall. It was Sam and others.

“George! Are you still here at the office? We figured as much … you dedicated old son-of-a-gun!” Sam burst out from down the hall. A mob followed him—friends and co-workers alike.

He saw Henry Stack, his former co-op student, bursting with pride. “HI GEORGE! HOW’S IT GOING, EH?  They’ve already PROMOTED me!”

A crowd began to form around the small table in the boardroom where George and Clarence had been sitting.

“We brought the party to you!” piped up Sam and others.

“Clarence texted the CIO on your behalf! We can help!” other voices joined in, many of them recent hires and most of the HR team.

A tall woman stood behind George. It was the company CEO, Ruth. “I’ve heard great words from the staff about you. It seems you’re in a tight jam?”

“You know you’ve got 12 weeks of unused vacation time, George?” piped in Violet from HR.

It seemed Clarence had learned to use Windows PowerShell a bit more once George had revealed its ease of use and flexibility. He had been snapping pictures of George’s sad face in the office, photocopied his letter of resignation, and pulled down documents showing the financials George had saved the company, and then emailing them to some select people with Windows PowerShell.

He knew a single email CCd to a large group could just get ignored. BCCd emails could get trapped by spam filters. He needed to make sure he composed a single email to each person.

So an email merge by using Windows Powershell would solve the problem.

Clarence, imported the data from Active Directory and used Windows PowerShell to build a simple email merge document to form a ‘unique’ letter to each executive. First, get a list of all senior Management.

IMPORT-MODULE ActiveDirectory

$SeniorMgmt=GET-ADUSER –filter * -searchbase ‘OU=Senior Management,DC=Contoso,DC=local’ –includedproperties EmailAddress

Now armed with a list of the most important people in the company, Clarence leveraged his new knowledge of Windows PowerShell to build a form letter for emailing the senior management.

Foreach ($manager in $SeniorManagement) {

$From=”Clarence Scripto <cscripto@contoso.com>"

$Displayname=$Manager.Displayname

$Email=$Manager.EmailAddress

$To=$DisplayName+” <”+$Email+”>”

$Subject=”George Shelley – Sad and Leaving – Help”

$Body=”Hello $Givenname, Our mutual friend George is having an incredibly bad day and encountering rough times.   Please email me back to discuss options to help him.”

SEND-MAILMESSAGE –from $from –subject $subject –attachments “sadguy1.jpg”,”sadguy2.jpg”,”taxletter.docx” –body $body –smtpserver $psemailserver

He then saved it as massemail.ps1 and quickly launched the script in his Windows PowerShell console.

Clarence had been fielding the details quietly on his Windows 8 phone while chatting with George. He had brought everyone up to speed. Management, upon hearing of George’s plight, had contacted resources and friends to aid him with budgeting his tax problems and the necessary help to deal with the impacting stress.

Ruth handed George an envelope. “Take some time off, Mr. Shelley. You’ve earned the next month somewhere warm with your wife.”

George’s hands shook as he opened it. Inside were two first-class tickets to Rio along with hotel accommodations.

The CEO continued. “The money you saved us when Clarence was able to come up with a management interface with Windows PowerShell, improving HR workflow, inspiring others around you, and saving us clients in the process; this is the least we could do. That … and my personal thanks.” She said patting George on the back.

Violet from HR came over. “…George, I just need you to sign here, because when you return, this is your acceptance of your new position as Automations Architect for Contoso, along with a slight pay increase.”

A smile and a tear formed on George’s face as he stared at the numbers in front of him.

Sam Coderight looked up. “So, George, staying? Henry will keep things warm while you’re gone.”

George burst out in a shout of joy so large and began to sing at the top of his lungs. Which turned out to sound only slightly worse than Shiminy Cricket, who quickly joined in chorus.

Clarence looked at George. “You silly fool. All of this good you did through Windows PowerShell. You know George, it really IS a Wonderful Shell…”

Thanks, Sean for adding to the holiday season … join us tomorrow as we will have another guest blog article, this time by Windows PowerShell MVP Richard Siddaway.

I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.

Ed Wilson, Microsoft Scripting Guy 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Great series! Got more than a handful of ideas reading these!

  • @Joseph

    Thanks for the feedback and support!  You just made my day :)

    Just wait 'til next year :)