Cisco UCS Powertool scripts using powershell

UCS Powertool scripts are handy, when you find yourself in situations where a project requires you to add 500+ VLANS to UCSM. When the task is time consuming you should find a way to automate it. If your scripting skills isn’t up to scratch, you need to weigh up the time to script vs manually performing the task. Hopefully, the Powershell script examples at bottom of this page may have turnkey script that could be a use to you.

Powertool guide for UCSM
Powertool guide for UCSM

Cisco developed UCS Powertool to automate UCS tasks using Powershell cmdlets. You can Download Powertool software and install it on the computer / server you have access to UCSM from. Once the executable has been installed, follow the simple steps below.

UCS ConvertTo-UcsCmdlet procedure:

  1. Load Cisco UCS Manager PowerTool. powertool program icon
  2. Connect to a UCSM cluster IP (or emulator) by typing “Connect-Ucs <UCSM-IP address> or <hostname>” command. Enter the UCSM login details when prompted.
  3. After successful login, execute the cmdlet “Start-UcsGuiSession -LogAllXml” in Powertool to kick off the UCSM GUI.
  4. Once GUI has launched, type “ConvertTo-UcsCmdlet” in the PowerTool window prompt.
  5. To get the commands for an action within UCSM, perform the steps as you would want within UCS GUI. e.g. Create a VLAN or Add a VLAN to vNIC template. If you are familiar with Excel Micros then this step would be something similar.
  6. After few seconds, UCS Powertool will spit out the cmdlets for the action you just performed in UCSM GUI.

If you have a long list of VLANS to add then best to stick it in an Excel spreadsheet and do what I did below and then save full commands as filename.ps1:

Excel UCS concatenate cmds
Excel UCS concatenate cmdlets

In some cases, where you already have bunch of VLANs within UCS and you wish to add some of it to VLAN Groups, then it’s easier to export the names to a CSV from the screen below and do what I did with Excel above to concatenate.

UCSM VLAN Export CSV

UCSM VLAN Export CSV

Some other common cmdlets in UCS Powertool are:

  • Get-Ucsblade
  • Get-UcsServiceProfile
  • Connect-UcsServiceProfile -ServiceProfile ServiceProfileName -Blade ServerID
  • Full reference list of Reference guide for Powertool can be found here for version 1.x.

You can check the operational status of the cluster and Fabric Interconnects using “Get-ucsfimodule ¦ select descr,operstate“.

Cisco UCS Powertool status
Cisco UCS Powertool status

UCS Powertool scripts example

Download instruction at end of this table!

1 Power OFF unassociated UCS Blades This script will enable you to power down un-associated blades by creating temporary service profiles. You’ll be surprised how much power you can save in a large server estate if you have unused UCS blades.
2 UCS AD Authentication Integration Powershell script to automate LDAP / Active Directory integration of UCSM.
3 UCS Inventory Tool Populates spreadsheet with extracted hardware information from UCS as an inventory.
4 Quick Launch UCSM GUI PowerShell Script Connect to UCSM GUI without asking for login prompt. This creates a secure credential file so it bypasses default login process.
5 Multi-Domain UCS Backup Script Login multiple UCS domains and take all 4 types of back ups.
6 Set User Labels for Servers Create user labels for rack and blade servers for better inventory.
7 UCS WWPN Collector Script Powershell script to output WWPN and vHBA details for each service profiles. Usually handy if you need to pass this information to SAN administrator for Zoning.
8 UCS Serial Number Export Script  Useful tool to if you need all the serial numbers to register with SmartNet.
9 Generate SAN Zones for Brocade or MDS  Collect Aliases, Zones and Zone Sets for Cisco MDS/Nexus or Brocade.
10 Checks the current bandwidth of all adapters  Displays details of bandwidth on all the vNIC adapters.
 Download these and more powershell scripts  Powershell script samples

Let us know if you are trying to script a task using this tool.

 

Add a Comment