Automating Cisco UCS Management with Windows PowerShell

May 31, 2011 - 0 Comments

As many of you know, a big part of the UCS story revolves around the flexibility we’ve built into the UCS management model.  While we hear great feedback from customers about the native UCS management GUI, we know that many of you have already invested lots of time in building automated solutions to repetitive IT tasks.  To that end, we want to help you find ways to use the tools and processes that have already been built along side of UCS.

We know that many of our customers are already running Microsoft applications on top of UCS.  For many of you, that means that you’re also likely automating repetitive tasks using Microsoft’s PowerShell scripting language.  PowerShell is an immensely powerful tool in an IT admin’s bag of tricks.  Introduced back in 2006, it has matured to become common across not only Microsoft’s business software, but also among their partner community – including NetApp, Quest Software, and even VMWare.

Shortly after we brought UCS to market, we got a specific request from an early adopter to build out PowerShell support for UCS .  Here on the team, nothing moves us faster than feedback directly from our customers, so it got the cogs turning and we’re happy to announce our first public release of the PowerShell Management Toolkit for UCSM.  We decided to even take that a step farther – besides providing PowerShell support, we’ve also made available .NET managed code that can be used to natively build UCS support into a .NET application.  For the rest of the post, I’m going to spend some time talking about some of the nifty ways in which UCS PowerShell provider can be used.  Fair warning here, folks – we’re about to get technical 🙂

For the brave among you, read on……

Off the top, I’m going to assume that if you’re reading this, you have some background knowledge of PowerShell and its architecture.  If you don’t, and would like to learn a bit about it, head over to Microsoft’s Script Center to get a great primer on PowerShell’s flexibility.

One of the first comments that commonly comes up when I introduce our PoSh toolkit to customers is “Why do I need that??”  And its a fair question – up until UCS, the idea of programmatically interacting with ‘dumb’ servers hasn’t made sense.  Since UCS is a stateless architecture, we can programmatically define a service, and then just leverage a shared pool of compute.  If we can interact with that service definition via a common language like PowerShell, the opportunity should start to become apparent.  This initial release of the PowerShell for UCSM toolkit includes over 75 cmdlets, supporting many of the most common operational tasks in UCSM, including:

  • Stateful connection management to multiple UCSM systems
  • Service Profile Management (create/modify/delete/association)
  • Log viewing/management
  • Server Power Management
  • Full Inventory Management
  • Raw XML input/output capability

It also includes standard PowerShell functionality:

  • Fully object based architecture
  • Command pipelining support
  • Standard inline help support (get-help syntax)
  • Standardized PowerShell verb usage

We’ll be updating the toolkit regularly to support new and additional features in UCS, and we’re eventually going to get to full manageability of UCS via PowerShell / .NET.

Now that we’ve told you what it is, lets explore a couple scenarios of how it can be used to make life easier:

#1: What if, for example, I’m an asset manager, and have a need to find all of my physical servers that have more between 24 and 48GB of RAM, and you need a report bak that designates their location in the UCS infrastructure as well as their Serial number.  But since I’m just the asset manager, I don’t need any more information than that.  Using a traditional server architecture, you’re probably going to have to go do some sort of management console, load the reporting view, and construct a custom report.  Using PowerShell, we can easily get the list in only one line:

Pretty Easy, eh?

#2: The first one was pretty cool, IMO — how about we try another one?  UCSM is a great tool for managing many UCS servers within a single console.  But what if  you have multiple UCS Manager instances – perhaps in data centers across the world??  The PowerShell toolkit is a great option for getting this data.  Since PowerShell manages all of the connection states, take a look at how we can connect to many UCS instances, then do queries against all of them from a single PowerShell session:

Here's the connection to my two UCSM instances.....

....and here is a snapshot of all the blades from both UCSM instances

#3: Alright – last one.  Lets put this to work in a more real-world scenario.  Take a look at this video.  A couple weeks ago at TechEd 2011, Cisco and NetApp announced our Hyper-V Cloud FastTrack solution.  Part of that solution leverages the automation capabilities via PowerShell and .NET that Cisco and NetApp have each built into our products.  In this video, you can see how we used System Center tools like Opalis and Service Manager to automate the provisioning of Cisco UCS blades for use in a private cloud solution.

As you can see, there are many, many different ways that the PowerShell toolkit for UCSM can make your life as a systems admin easier!  To try out the PowerShell toolkit, visit the Cisco Developer Network – the PowerShell toolkit can be downloaded by anyone with a CCO account by visiting this link.  Check back frequently as the toolkit will be updated often.  End-user Support for the PowerShell Management Toolkit for UCSM will be via the Microsoft Discussions forum on CDN.  Please feel free to contribute your own sample scripts and usage there as well!

In an effort to keep conversations fresh, Cisco Blogs closes comments after 60 days. Please visit the Cisco Blogs hub page for the latest content.