Oliver Script: A Holiday Tale–Part 5

Doctor Scripto

Summary: Oliver joins an enterprise environment and introduces Windows PowerShell to DevOps.

   Note This is the fifth post in a series. To catch up, read:

It is Oliver's first day in an enterprise-class environment…a day full of excitement, and…co-op students?

Only moments after walking in, he found himself surround by a batch a young interns asking which machine they should reimage next. “Who sent you to me? This is my first day.”

“Fagin.” One of the youngest ones (probably not even in grade 10) piped up. “We’re Fagin’s interns. We spent all day installing applications, reimaging workstations, and cleaning up viruses.”

“That’s Mr. Fagin to you,” a sharp voice barked, and they all scattered like small frightened mice. “Ah, so you’re Oliver, eh? Let me introduce you to your boss, but I think you’ve already met.”

His boss was none other than Jack Dawkins, one of the younger and more brighter IT fellows out there. He walked toward them in a three-piece suit, espresso in one hand and a rather massive looking binder full of CDs and DVDs in the other. He handed the binder to Oliver. “Ready to start?”

“What’s this?” Oliver looked puzzled as he glanced at the massive pile of media handed to him.

“Everything,” was the simple response he received with a wave of his boss’ hand as he moved off towards a meeting.

Oliver opened the package and examined the contents. It appeared to be media for every application available from Microsoft. Did he mean for Oliver to install all of this?

Catching his supervisor later in the day, Oliver asked for some clarifications and details. “What did you need me to do with these?”

“Deploy all of it—every single server application, component, feature, bell, and whistle. We need to be able to showcase our new environment to Microsoft. It’s all going to run on this one computer running Windows Server 2012 R2 with Hyper-V. It has 288 gigabytes of RAM!”

Oliver was confused and excited at the same time. All of these applications! The learning opportunity he was about to have! But it seemed a bit much for a division of only eighty staff.

“Pah! I want every component of this operation manageable, whether they think we need it or not.” His boss waved him off, “Better get going, the migration happens in sixty days!”

Another part that had been slightly glossed over in his interview for this job—a complete migration from Windows XP to Windows 8.1, including a full cutover to Exchange Server 2013 from Exchange Server 5.0, full VLAN segregation, DMZ splitting, federation with the corporate head office, and a rewrite of every application in the entire office.

And to make things fun, they planned to yank administrative rights from the developer team. “Get chummy with the developers—you’re about to be very busy, Mr. Script.”

Oliver spent the next three weeks with his head buried in TechNet articles and speaking heavily with the development staff.

The first words from one of the developers echo in his mind, "What do you mean we won’t have local admin rights on the servers?” The ground shook as the developer known as “Rogue” spat at the ground. Poor Oliver had been gifted with the privilege of being the first one to break the news to the development team. They almost leapt over the cubicles to tear him apart.

Fortunately for Oliver, none of them wanted to spill their cups of freshly poured Starbucks coffee, so for the moment his life was spared.

He returned later that day to chat with Rogue to gather details about their challenges, hoping to make things smoother. “Well,” indicated Rogue, “if we didn’t have to install everything ourselves in the production servers, as we have in the past, it might not be too much of an issue. But the challenge we’ve always had was in handing over documentation. If we missed something or it was miscommunicated, the production server might be missing a key component or two. So we usually need the rights to correct the mistakes. If only there was a way to capture the features installed on the development server.”

He showed Oliver one of the development servers, which was operating with Windows Server 2008 R2. Oliver pointed out that Windows PowerShell might be able to provide a solution.

“Really?” popped up Rogue, “With a big fancy script? I could probably code something in VBScript, but that would take time.”

Oliver pointed out that they could show all of the features on the server with the Windows PowerShell cmdlet Get-WindowsFeature. As data scrolled down the screen, the developer noted an “X” was selected beside all of the installed features.

“That’s pretty cool," Rogue admitted, "but it would be better if I could filter it so I see only what’s installed. At least then I could type an accurate document for the Change Request.”

“Actually, all of this runs under .NET, so I can access individual properties of the object by pipi…” Oliver began to explain.

“Wait!” spoke up Rogue, “Did you just say ‘object’? That’s a developer term. IT pros don’t know what objects are!”

Oliver smiled. “To be honest, I don’t really understand code all that well, but as I was saying, Windows PowerShell runs under .NET. So in learning how to work with the output in Windows PowerShell, I did learn a little about objects.”

Rogue smiled. “Well who would have thought an IT pro and a developer would have some common ground! So please continue. You were mentioning filtering that object output?”

Oliver nodded vigorously and continued, “In Windows PowerShell, we can pipe data like we did in DOS, but it’s all objects now. One of the cmdlets is called Get-Member, which exposes the properties and methods that are available within an object.”

He showed this on the screen with the Get-WindowsFeature cmdlet. They saw the following output:

Image of command output

“This particular cmdlet has a property called Installed, so I can actually filter the information by using a cmdlet called Where-Object. I can at least provide a visual list of what features you have installed in this manner.”

Get-WindowsFeature | Where-object { $_.Installed }

His developer friend looked on as the screen displayed only the list of installed features. You could almost hear his jaw hit the ground.

Image of command output

“But that’s not the answer, is it?" added Oliver. "Somebody on the team could still make an error. Even with a detailed list of the features, people can forget to check off a box if it’s a large enough list.”

“True,” nodded the friendly Rogue, “How do you mitigate that?”

“Within Windows PowerShell is a cmdlet called Export-CLIXML, which allows an object that is sent to it to be stored as an XML file. So I can capture your list of features, which is an object, and store that as a file.”

Get-WindowFeatures | Where-Object { $_.Installed } | Export-CLIXML features.xml

“You still need to fill out your Change Request because we need the paperwork for our auditors and the internal business process, but I can at least make our jobs easier,” said Oliver.

Rogue looked over, “Let me guess, you’re going to say that there is a way to reverse this process by using that XML file, aren’t you?” A smile bigger than the moon spread across his face.

“Absolutely!” shouted Oliver with such vigor that many heads popped over the surrounding cube farm. “I simply copy that file to the production server, or even to a QA server, and run the Import-CLIXML and Install-WindowsFeature cmdlets to reverse the process.”

He copied the file to the box with the freshly installed Windows Server 2008 R2 software, and he ran the following command:

Import-CLIXML features.xml | Install-WindowsFeature

Moments later they were staring at a server with all of the same operating system features as were on his development box.

Rogue looked on in amazement, “So little work to make all of this happen.”

“Oh, by the way…I have some free utilities from Microsoft to help make your applications run without local administrative rights if you’re interested,” offered Oliver.

Rogue looked on in Casablanca style, “I can see this will be the beginning of beautiful friendship.”

The day of migration approached. Jack looked at Oliver, “Are we ready? The entire system cuts over in fourty-eight hours.”

Oliver blinked and gulped. He had been working heavily with the development team to make it all work. But there was so much content and data. He nervously sat in the prefabricated war room, surrounded by all the development team, with a stack of Cisco telephones, one recently rented Starbucks coffee machine, and a gross of donuts.”

“Maybe we are ready…” was all poor Oliver could mutter.

As the time passed, Exchange Server environments began to link, directory structures and trusts were established. Workstations were reimaged. The forty-eight hour expectation turned in to forty-eight days. Poor Oliver was trapped in the office, but he was finally finished, reeking of his own smell.

He looked to his boss, Fagin, ready to be terminated. Fagin smiled, “Dude, I was kidding about the forty-eight hours—the project was meant to take forty-eight days.”

A sigh of relief passed through Oliver.

Over the next year things began to improve and go badly for Oliver at the same time. Fagin’s interns were trimmed to a single person because the new infrastructure was far more efficient and secure.

The company began to triple in size, which meant new IT staff members were brought on board. Oliver’s job became far easier with the additional help. But unfortunately, boredom began to rear its ugly head due to his growing automation skills. Even with a company this size, he was able to easily manage features with a simple Windows PowerShell cmdlet here and there.

Oliver loved his job but he loved challenges even more, and his dream of working for Microsoft had never gone away. He began to dream about wandering the halls in Redmond and meeting the people who made it all happen. So with hope and trepidation in his heart, his resume began to flow to careers.microsoft.com.

His ventures landed him an interview or so with Microsoft, but even Oliver knew he wasn’t quite ready. His raw skills were there, but he needed experience and also a way to calm his excited attitude about working for them.

Yet during this process, something he didn’t expect happened. An interview with a Microsoft Partner came along. They were looking for someone with his exact skill set. “We’ve decided to hire you instead of grabbing some blade servers,” was the odd statement he heard.

It was an amazing opportunity in a new city. The only drawback was that there was a lot of snow in this area. Oliver thought about a warning he’d heard about snow. It was a Frank Zappa tune that rang in his head, and for that reason, snow scared him.

Oliver had also learned to embrace some of his fears, and he took the leap of faith. He signed on and packed everything he owned into a 17-foot U-Haul trailer, then made the long drive through a blizzard to his new home and job.”

Will Oliver overcome his fear of snow? Will he finally be happy with his new job? Will he ever meet Bill Gates and get his autograph? Stay tuned for tomorrow’s episode of Oliver Script: A Holiday Tale on the Hey, Scripting Guys! Blog.

We invite you to follow The Scripting Guys on Twitter and Facebook. If you have any questions, send an email to The Scripting Guys at scripter@microsoft.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, remember eat your cmdlets every day with a dash of creativity.

Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy 

0 comments

Discussion is closed.

Feedback usabilla icon