yblaz - Fotolia

Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How PowerCLI fit one admin's VMware automation needs

Through PowerCLI, a busy IT shop can cobble together its own solutions to handle numerous deployment and administration needs.

While there's little doubt server virtualization has made life easier for the systems administrator, it still amounts to a juggling act for an operations team that must maintain existing systems while responding to a never-ending stream of initiatives from the business side.

To keep up with increasing demands, administrators in a vSphere environment have found some relief by using automated means to quickly knock down routine management and configuration tasks.

While there are various VMware automation offerings to fill this need such as vRealize Automation and vRealize Orchestrator, many administrators already are familiar withPowerCLI due to its foundation in PowerShell -- a language used to manage Windows systems. Another advantage to PowerCLI is there is a plethora of scripts available from various resources that can be refashioned to tailor workflows for particular environments.

Philip Sellers is a senior systems administrator in the telecommunications industry and found PowerCLI was a good fit for his needs. Sellers picked up a few tricks as he grew more proficient with PowerShell scripting and wrote the PowerCLI Cookbook as a way of giving back to the VMware community. Listen in as I ask Philip about other VMware automation tools and what features in vSphere 6 are making the lives of administrators easier.

 This is Tom Walat from SearchVMware and I'm speaking with Philip Sellers. Philip is a senior systems administrator in the telecommunications industry, an active blogger on various IT-related topics such as networking and virtualization and he's written a book for Packt Publishing entitled PowerCLI Cookbook that has been enthusiastically received by many people in the VMware community. Thanks for joining me today, Philip.

Philip Sellers: Thanks for having me, Tom.

Could you give me a little of your background in IT and how you found yourself gravitating to this field?

Absolutely. I am a systems administrator at the present time, but in the past I've been a consultant and end-users support tech in various roles. It's been a natural progression for me. I got a computer sometime during middle or high school and it's always sort of been the interest that I gravitated toward. So it's been a fun ride for me.

I noticed in you LinkedIn profile, that you've got some Web application programing experience. How did you find yourself getting involved with PowerCLI?

So, I do have some development experience and background, but I found myself gravitating back toward the system management side of the house and in my present role, I am the primary VMware architect and administrator for the company I work for. And so, we've got various VMware farms and lots and lots of VMs now as we've adopted a VMware-first attitude or at least a virtualization-first attitude. And so as that workload has grown and the number of things to manage and maintain has grown, PowerCLI was a natural progression, out of requirement, to be able to manage the environment and automate things and make it easier to manage and know when things are happening or fix problems when they occur.

Now had you look into any other ways? Because we're always hearing how IT, you've got more to do and less time with fewer people. Were there some other products or things you were looking at to automate different processes in your data center?

We investigated a lot of different management and monitoring tools for our VMware environment. We adopted that virtualization-first attitude and so our workload and things have grown significantly. We've done some stuff in the Perl toolkit, We've done some things in vCenter Orchestrator. What I've found in Perl was, it's not a language that I was very comfortable in and it's very programmer-centric. With vCenter Orchestrator, it's great and its built-in tools and it is extendable but it's somewhat restrictive. And in addition to doing some VMware in our environment, I'm also a Microsoft administrator so all of the Microsoft tools have PowerShell administration tools and I was already learning PowerShell so PowerCLI was a great fit for our environment. And when you start combining PowerShell and PowerCLI you can get some really powerful scripts and automation by pairing the two together.

Are you seeing a trend now, with other administrators, where they want to start automating tasks in their environments? And are you seeing maybe, more people saying, "Maybe PowerCLI is something that would work for me?"

 

I think so. I've had some pretty cool conversations since writing the book and the things that come back over and over to me is that we're being asked to do more with less. And when it comes to doing more with less, you've got to start automating. So it's survival for most administrators to be able to start to script and automate some of their processes and PowerCLI is pretty flexible for that because you've got lots of built-in functionality that you can use the standard cmdlets for but then you can extend it and do custom scripts and extend the language to do and fit your exact needs and your exact environment.

So what's an example of some of the PowerCLI scripts that you have running in your environment?

So one of them, and I wrote about this in the book, is one that actually came from Chris Wahl who's another prominent blogger in the VMware community. But it's one to balance out our DRS groups and basically assign values to the DRS groups based on the number of VMs that are running in each resource pool. They keep everything balanced and running correctly because one of the things that can happen is, you get resource pools that get out of balance then you can have resource constraints that take your production VMware machines -- your virtual servers -- and this will really make them run badly. So that's one example. Snapshot maintenance is another. Being able to quickly and easily get a list of what snapshots exist and then, if they meet certain criteria, go ahead and automatically delete those, just so you don't get into a situation where you've got a data store that fills up and you've got virtual servers that go down. So taking an attitude of being proactive and trying to identify as many of the things in a generic way so that I can script something that can be multipurpose. The more I can make it a generic use-case, the more I can reuse it.

And what sort of advice would you give somebody who may not have the type of programming experience that you have and they want to get started with PowerCLI? What were some of the first things that maybe they should look at and maybe twitter people or blogs or books? Obviously your book is definitely one they should check out but what else is out there for them?

Yes, there's lots of VMware blogs and particularly around PowerCLI. The VMware official blog for PowerCLI is a great place to start because there's a lot of information in there. What's great about the language is that you don't necessarily have to have a programing background. So if you do, you can certainly apply it here, but I think most people who've been in the industry or maybe have a computer science degree, have had some sort of exposure to object-oriented languages and have a basic understanding of objects and if you understand data objects and that general programing concept, that's going to take you a long way to using PowerCLI, because it's an object-based mentality in the language. Now there are tons of built-in functionality so, that's where I would say you should start if you don't have a programing background at all. You open the CLI, start using new-VM cmdlets that are built-in and then it works like any other command line tool. You pass in some parameters and you can do you work and that's where you really start to get started. Use the built-in stuff, get very comfortable with that and then you can start to extend it beyond the built-in functionality.

When you're working and you're developing a new PowerCLI workflow, I would imagine you're preparing this in a lab environment?

I do. Sometimes I do, sometimes it's on the production systems. There's a lot of times that I may not prepare a script so that it's run on a schedule. It may be something that I'm doing interactively so, provisioning new virtual machines for instance. If I've got 10 or 12 new virtual machines to deploy from template, I'm going to get a PowerCLI before I go and do them manually in the GUI and point and click 10 times for each one of those. It depends. If I am developing a script though, I do have a lab environment and that doesn't necessarily have to be a separate from production sort of thing. You could have a resource pool or you could have just a testing area where you've got some VMs set up that you can manipulate and start to work with PowerCLI. Having a completely separate one's going to be a whole lot safer but it's not a requirement by any stretch.

What is some functionality you'd like to see get added to PowerCLI?

The thing that I think would be most powerful is some native DRS group management tools. So managing DRS groups and the affinity groups that are part of your DRS clusters, that functionality. Being able to automatically add or update the membership of those groups is pretty cool. Within my data center, I've got a Metro Storage Cluster and so I'm stretched across two physical data centers and we use affinity groups to say this VM should run in data center A and this VM should run in data center B. So we've created custom scripts using, leveraging stuff that's out in the community and forums and on blogs and we use that within our environment but that's the beauty of it is that someone else has already contributed that even though it's not part of the official distribution.

What got you interested in writing a PowerCLI book and what was the writing process like for you?

I kind of got to the place that I thought, "Hey, I could write this." because I was using it on a daily basis and I really found it useful in my day job. So I wanted to put something out there that would help other people adopt it. I had worked with the publisher previously, as a technical reviewer for another PowerCLI title, so when they approached me and asked me about this particular topic, I said, "Yeah, I think I've got enough I could say about this and try to help someone else adopt the language and figure out how it can help them in their environment." The writing process was actually pretty simple. What's great about working with a publisher like Packt is that they've got their styles already created. They've got their layout and formatting already provided for you, so it gives you a roadmap and it breaks it up into manageable chunks. So I had a few weeks to create the first draft of each chapter and get all of the code and labs and directions created and then turn that into the publisher. And then they were able to edit it, send it through a technical review process with several other IT folks reviewing everything that I said works and making sure those code examples work as they were intended. And once you put all of that together, it's pretty simple at that point for them to turn it around and get it into print form or into an e-book format.

In addition to vRealize Automation and Orchestrator there's some buzz out there about third-party automation products such as Ansible. For someone who's not looking to code from scratch but wants to streamline various administrative tasks, where would you direct them?

Working from a command line can be really intimidating and so there's probably a lot of people that aren't comfortable with PowerCLI for that reason. One great thing that you could do is, if you've got an administrator who is comfortable and can put together some PowerCLI, there's actually a Fling, which is VMware-speak for an unreleased beta lab software, but there's a Fling that can basically take PowerCLI and execute it from within the vSphere Web Client. So then you open up your script to any level of user regardless of their programing background or their comfort with the command line.

The vCenter Orchestrator is another great tool because it's a drag-and-drop interface to get you some basic automation. There's built-in functionality to talk to Active Directory and vSphere and to create emails or pull out information and do work, and it's a pretty approachable interface. For somebody who's looking for that total solution then there are lots of third-party applications like Ansible or vRealize Automation that give you that more friendly interface to it. There's a lot of competition in this area because as we drive towards that software-defined vision, automation is key and it's the part of the process that gives us those repeatable outcomes, so that we can start doing things in a standard way over and over and over again, that help us adopt that cloud mentality.

VMware has been pushing its vision of the software defined data center and now we're seeing policy based features in vSphere 6 such as VVOLs. What's your take on this latest release of vSphere and what are some of the new or improved features that matter the most to you?

I have to say, you mentioned VVOLs and I really like the vision there, because it's given that object-level representation to virtual machines on lots of different third-party vendors storage. And some of the problems that you've traditionally had in the storage layer, managing VMs on VMFS data stores and running out of disk space or not being able to grow a VM because the VMFS data storage is not large enough to accommodate it. And dealing with extents and things like that, all that stuff goes away with VVOLs and that's pretty cool. We're still waiting to adopt it, until a little bit later time, in our environment but I am excited to look into that because it frees up some of the administrative time. Data clusters and things allowed us to be a little more hands off with our storage management but VVOLs is that next step in the evolution.

In addition to that I'm excited about the changes that have been made within the management layer in vSphere 6. The changes to vCenter and the way that you do your certificate management and the new model for the single sign-on architecture and those kinds of changes are great from an administrator standpoint. Because it helps us do the nagging things we have to do, more easily. So, most of the things I'm excited about are going to be very functional enhancements to the platform.

Now Docker and containers have gotten a lot of attention and now VMware has several infrastructure projects to help manage applications based on microservices. Are containers starting to make their way into your end of the data center?

We're starting to have conversations about containers and one of the changes that has to happen isn't within the administration group. So for this sort of architecture o take off, you've got to have developers on board and they're going to have to develop in a slightly different way. They're not going to be building big monolithic applications. They're going to have to break it up and there is a certain amount of administration that the developers will take on and defining what their container looks like and what it needs. And those are some challenges because it requires an organization to pivot a little bit from the traditional way of doing things and I think that's going to be a huge challenge moving forward with the adoption of those services. Now the payoff is huge, too. It allows you to move faster and deliver services faster and on an iterate basis. There's certainly a big payoff if you're willing to make the investment to change the way that you're doing things. We're talking a lot about it, but we've not made a lot of headway towards those changes yet, but we're watching it really closely. I will say, VMware's work around containers inside a vSphere is important to us because from an enterprise perspective and keeping our services up and going, we appreciate what VMware has brought to the table and what it allows us to do to keep our business operating. So making these first-class citizens just out of VMs is a huge step, because it lets us use a single platform to deliver both types of architecture.

Now lastly, any predictions on what might be coming from VMware and this year's VMworld?

I hate making predictions because I don't know. I don't have a clue this year. I was a little surprised at some of the announcements last year around containers, but not all that surprised because it's a technology that was putting pressure onto VMware. So adopting it and making those technologies fit within their flagship product made a lot of sense. But going into this year, I'm really not sure and so it will be cool to be at VMworld and see what they do announce.

Okay, Philip. Thank you for taking the time to speak with me today.

Absolutely. I appreciate the time to have a chat.

Next Steps

The difference between vSphere PowerCLI and vSphere CLI

Find the VMware automation tool that works for you

vSphere PowerCLI vs. CLI vs. ESXi Shell

This was last published in July 2015

Dig Deeper on Scripting administrative tasks

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What automation tools are you using in your environment?
Cancel

-ADS BY GOOGLE

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close