Using UCS PowerTool To Set Equipment Labels

Share on:

For conformity, we like to set the UCS Equipment labels to match the Service Profile Name. This allows us to match it quickly without having to dig down into the assigned profile. This script will set the UsrLbl and Name fields on the equipment tab to match the name of the Service Profile.


Preparing to Execute the Script

The script is pretty straight forward, just need to define a few variables seen below and then you execute the script. I will walk you through the process.

This script is currently setup to be applied to Rack Units. To have this work for blades, change the Get-UCSRackUnit and Set-UCSRackunit to be Get-UCSBlade and Set-UCSBlade.

 1#Define Variables
 2$cred = Get-Credential
 3$domains = "ucs01.lab.local","ucs02.lab.local"
 5#Cycles through each UCS setting values
 6Foreach ($ucs in $domains) {
 7  Connect-UCS $ucs -Credential $cred
 8  $servers = Get-UCSRackUnit
 9  Foreach ($server in $servers) {
10    Get-UCSRackUnit -id $ | Set-UCSRackunit -UsrLbl $server.assignedtodn.substring(12) -Name $server.assignedtodn.substring(12) -force
11  }
12  Disconnect-UCS

Execute the Script

  • Run .\Set-UCSEquipmentLabel.ps1
comments powered by Disqus

See Also