It’s a Wonderful Shell—Chapter 1

Doctor Scripto

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

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

George Shelley, IT admin, is having a miserable week. Too many projects on the go, a critical company file inadvertently wiped, and to top it off, he was missing the holiday party because of some last-minute maintenance required in the datacenter. On top of it all, after finally sorting out ten years of taxes from working in the field as a consultant, he had a massive bill that he couldn’t foresee solving.

All that effort and nothing to show for it.

Grumbling to himself he muttered, “I’ve had it. This job is the pits. Nobody appreciates what I do. I’m not getting anything done and all those years’ effort wasted. And to boot, I’ll bet nobody even cares that I’m not at the party.”

Staring about the room he pauses and whips a crimper at a small helpless cricket on the wall. The cricket shakes his leg angrily and gestures in a manner deemed quite rude by crickets.

“Damn this all!” he curses openly to no one. “I would have been better off not taking this career in the first place. I’m going back to making french fries.”

He begins walking towards the datacenter door, dropping his new Surface, and casting his phone to the vast depth of cabinets. His keys slammed to the floor, splitting apart from their ring and scrambling into cornersnearly hitting that same hapless cricket. 

Little did he know, his voice had been heard by someone…

“George, is that you?” said Clarence, a member of the development team whispered with great caution through the door.

Late nights, early days, and even weekends, here was the only person who could truly sympathize with an IT person about the crazy stressful hours they worked. It was rumored that developers even worked on holidays. As a result, they had become compatriots over the years.

Grumbling like a bear that had eaten a whole crate of Captain Crunch and bacon, George snapped back as he stormed down the hall, “Yeah it’s me. Not as if anyone cares. All my time here is wasted. The only thing I have to show for it is one good friend. But sorry Clarence, I’ve had it. I’m leaving.”

Clarence stood there dumbfounded. First, George was leaving, and second, he appeared to have Clarence’s last bag of Fritos hanging out of his pocket.

“You think you’ve achieved nothing? Would it surprise you how much you have made a difference? With the introduction of Windows PowerShell to our network, you’ve changed many lives for the better.” 

George shook his head. Like many IT pros, the job felt thankless.

Tugging him by the sleeve, Clarence gestured towards his laptop. “Do you really think that’s true? Remember ages ago when our team had to develop an application? We were so rushed and under budgeted that we couldn’t create a management interface.”

George vaguely remembered the day his friend was in a crunch. The in-house application had been released and immediately it was sold to the customer—sales people oversold its abilities, and the lack of a management interface was overlooked.

…But, it was still desired by the customer, for some odd reason.

“I came to you in tears that day. With no research and development time and a simple web service for communications, you looked up with a wry smile on your face. ‘Powershell’ is all you had to say, just ‘Powershell.’”

George’s face cast back to that forgotten day, when someone’s life was brightened with such a simple suggestion.

“I remember how down I felt that day until you exposed the cmdlet for converting a web service’s methods and properties to a Windows PowerShell object.”

George Shelley paused. It seemed so simple to him as the answer. Leverage the NEW-WEBSERVICEPROXY cmdlet.

“All we had at the time was a simple web service for managing our users, which we would call manually to enable and disable accounts. Yet, as soon as we had written that, the application was going live. I had spent that night pouring my soul out to a fry cook about our problem. With no interface and thousands of accounts to populate the next day, we were doomed. It could have cost us millions in a lost contract. Possibly my job. All the fellow would offer me for condolences was some extra gravy on my fries.”

George remembered clearly the web service as if it were yesterday. A simple URL ending in SVC. It seemed unlikely that such a small thing would be such a large problem.

“But YOU! You showed me a simple answer that Monday morning! Our systems and our clients were all running Windows PowerShell natively as part of Windows 8 and Windows 7, so we only needed to create cmdlets. It took you all of a few minutes working with development to show us how!”

George did remember that day. He took the URL and pulled its methods and properties out with the NEW-WEBSERVICEPROXY cmdlet like this:

$ServiceURI=’ ‘http://contosoapp.contoso.local/useraccess.asmx?WSDL’

$AppConnection=NEW-WEBSERVICEPROXY –uri $ServiceURI

$AppConnection | GET-MEMBER

TypeName: WebServiceProxy.useraccess

Name                     

MemberType

 Definition

—-                     

———-

 ———-

 

Abort                    

Method

System.Void Abort()

Equals                   

Method

System.Boolean Equals

NewUser              

Method

System.Xml.XmlNode

DisableUser        

Method

     System.Xml.XmlNode

GetUserList            

Method

     System.Xml.XmlNode

GetType                  

Method

System.Type GetType

ToString                 

Method

System.String ToString

     

“George! When you showed me this, my eyes lit up!  When you showed me we could access our existing web service to get users directly from the Windows PowerShell console like this…”

$Users=$AppConnection.GetUserList()

“…I suddenly realized we could provide the answer to the customer in moments! You showed me how to build that as a very basic function by doing this:”

Function Global:Get-UserList()

{

           [xml]$Users=$AppConnection.GetUserList()

           Return $Users

}

And to pull up users from Clarence’s application, they only needed to type:

GET-UserList

“Granted, the answer wasn’t perfect, but with minor changes, we were able to build three simple cmdlets to create, disable, and list users for the client with simple instructions about how to build a CSV file to populate multiple accounts.”

“George, you saved not only a massive contract with the company, but possibly my job. How can you ever think about quitting? How could you conceive that you weren’t a positive influence?”

George nodded. His friend Clarence was correct, but this was only one person. He appreciated the difference he made, but he shook his head slowly, “I’m still leaving. I doubt anyone will really care anyhow.”

“Then George, give me an hour and barring any commercial breaks, if you STILL think you didn’t make a positive change and nobody’s life here in the office would be better, I’ll personally buy you a first-class ticket to wherever you want to restart.”

Clarence was a good friend and George conceded, “An hour is yours, my friend, but I assure you, your time will probably be wasted.”

Clarence smiled inwardly to himself and thought quietly, “No. But you will be in for a ride tonight.”

Join us tomorrow for part two of It’s a Wonderful Shell.

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

0 comments

Discussion is closed.

Feedback usabilla icon