From the Trenches Stories: Working with What You Have

Adam Bertram

Adam Bertram

Read more posts by this author.

As I roam the halls and rooms in Seattle this week at the PowerShell & DevOps Summit 2016, I’ve been directly involved in or have overheard many different conversations. The most interesting discussions include real-world stories; stories that either highlight the successes or struggles of every-day IT life.

I’ve decided to pick out a few of these stories and make a small series of blog posts to give you a sense of the kinds of great things you can learn. For this first post, I’d like to talk about a struggle from an attendee I’ve spoken to. In the end, leave a comment if this sounds familiar and how others may avoid it.

On Monday, I was talking with an attendee that worked for an unnamed large university. He was part of the internal IT department and occasionally had a need for new virtual machines. Since he was part of a large organization, he wasn’t on the team that provisioned the VMs. He had to put in a request for a VM, and that team would spin up one for him.

He had a web form that was provided to him he had to fill out for every…single…VM. If he needed five VMs, he had to complete the web form five different times. This involved putting in his name, department, phone number and VM information each time. As you can expect, it was terribly inefficient.

He wasn’t allowed to provision VMs himself. This web form was his only interface to use to “create” new VMs that was taking him way too long. I had a solution for him that was the best “bad” solution I could think of, automate the web form input.

When building a new VM, you might have a cmdlet called New-VM to create a Hyper-V or VMware VM. This cmdlet directly provisions a new VM on a host. He didn’t have this luxury. He had to fill out that web form. I recommended he create his own “New-VM” which only filled out a web form. This allowed him to “automate” building a new VM yet the best way he could.

Here’s what this function might roughly look like:

function New-VM {
    [string]$Uri = ''
    foreach ($vm in $VMName) {
        Invoke-WebRequest -Uri $Uri -HTTPPost ## whatever

This is a function that does what functions to best; abstract away the details. Regardless if your New-VM doesn’t create the VM, it still automates everything you can do. This is working with what you have. This is the beauty of code. You can abstract away the details and create a solution that automates tasks that are customized to your unique circumstances.

Subscribe to Adam the Automator

Get the latest posts delivered right to your inbox

Looks like you're offline!