PowerShell to Automate Cisco UCSM (4): PS with .Net to develop UI and provision service profile

PowerShell to Automate Cisco UCSM (4): PS with .Net to develop UI and provision service profile

Introduction PowerShell to Automate UCS (1): Lab Setup introduced the UCSM and PowerTool lab setup. PowerShell to Automate UCS (2): PowerGUI Editor in

PowerShell to Automate Cisco UCSM (3): Convert UCSM GUI to Script
PowerShell to Automate Cisco UCSM (2): PowerGUI Editor
PowerShell to Automate Cisco UCSM (1): Lab Setup

Introduction

PowerShell to Automate UCS (1): Lab Setup introduced the UCSM and PowerTool lab setup.

PowerShell to Automate UCS (2): PowerGUI Editor introduced how to use PowerGUI as PowerShell script editor to simplify script development test; and also script example.

PowerShell to Automate UCS (3): Convert UCSM GUI to Script introduced how to start from 0 and write PowerShell script to manage UCSM by converting UCSM GUI to script.

This blog demonstrates how to integrate PowerShell and .Net to develop a user interface to check whether a server is in use, then select unused server and provision service profile from the established service profile template.

Preparation

Access to UCSM (we are using UCS platform emulator in this lab) as in PowerShell to Automate UCS (1): Lab Setup. Verify there is an established service profile template and vacant servers to use.

The lab I am using had a sudden power outage last week and corrupted the UCSPE; all chassises and servers disappeared. The equipment inventory (https://x.x.x.x/config/) shows all devices are normal.

UCSM_inventory.png

If you experience the same, set the UCSPE to factory default, which forces clearing its database and re-inserting devices.

UCSM_factoryreset.png

PS and .NET Script

PowerGUI was used to develop and test the script. Please refer to PowerShell to Automate UCS (2): PowerGUI Editor.

Running Result

Run the script in PowerGUI or natively in PowerShell, a window will popup showing existing server status so that a user can select a unused UCS server to provision.

dotnet_ps.png

Let’s access to UCSM GUI and verify whether the server is successfully provisioned.

spprofile_provisioned.png

The End

This is the end of my PowerShell/PowerTool to automate Cisco UCSM series. Hope you find it helpful.

BTW, I am listening to Vishen Lakhiani’s ‘The Code of the Extraordinary Mind’ while writing this post in this sunny Sunday afternoon. Vishen asks what’s the real goal in life? My answer is to love my current and future self. Enjoy every day we have now, don’t leave all fun till retirement. Love ourselves and extend the love to others.

COMMENTS

WORDPRESS: 0
DISQUS: 0