cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

UCS Serial Number Collector PowerShell Script

14935
Views
17
Helpful
36
Comments

I had a customer ask me for a way to easily collect all serial number from a UCS so they could give to their services team to make sure everything was covered under their SmartNet contract.  This is what I came up with.

This script allows you to log into a single or multiple UCS Domains and it will create an Excel spreadsheet of all the devices and their serial numbers.

Prerequisites:
  PowerShell v3 or greater enabled on your client machine
  Network access to your UCSM
  An account on your UCSM
  Excel installed on the client machine
  Cisco PowerTool for PowerShell installed in the client machine

Change Log:

     v0.5 - Initial posted version

     v0.5.01 - Added feature to exit script if you only provide a single domain and domain log in fails or if you are not logged into any UCSM.

     v0.5.02 - Added one more error check for login

     v0.5.03 - Found that older B230's that don't have DIMMs in a slot report their serial number as NO DIMM.  Look for that and ignore entering those into the inventory.

     v0.5.04 - Requires PowerShell V3 and now has a check to ensure you are running it or higher.

     v0.6 - Added a column with the associated Service Profile for the equipment where applicable.

     v0.7 - Added a column with the manufacturing date/time of the equipment where available.

     v0.8 - Added section to collect local hard disk info

     v0.9 - Added built in help.  Command line options.  Standard naming convention.

     v0.9.0.1 - Added support for saved credentials file

     v0.9.10 - Add fields with UCSM Licensing Information

As always, let me know if you have any questions, problems or suggestions.

Joe

Comments
Community Member

Thanks for this script Joe, it's really handy. I just had to change the name of the PowerTool module you are checking for to Cisco.UCSManager. I guess the name has changed under v2.0.1 of PowerTool.

Regards,

Mark

Cisco Employee

Hello all.  If you are using a newer version of PowerTools (beyond 1.x), the Power Tool module name has changed-- you will need to update the following 2 lines in the script for it to work (find & replace):

Original: (find)

Import-Module ciscoUcsPs

if ( -not ($Modules -like "ciscoUcsPs"))

Updated: (replace)

Import-Module Cisco.UCSManager

if ( -not ($Modules -like "Cisco.UCSManager"))

Then it will work properly.

Have a great day,

Jim

Community Member

Joe,

This is really a good tool.

This has helped us a lot to be more efficient in terms of purchasing support contracts as well as inventory tracking.

Appreciate the efforts into it..

Community Member

Thanks Joe! Super helpful!

Beginner

@joemar This script is still usable here in 2018.  There's a typo on line 327, though, that causes the resulting spreadsheet to be blank:

 

it reads

 

$Worksheet += $Workbook.Worksheets.Item(1)

 

and it should be

 

$Worksheet = $Workbook.Worksheets.Item(1)

 

Since $Worksheet is previously undefined. This also causes a problem if this is run more than once directly inside the ISE. $Worksheet becomes and array and none of the calls to $Worksheet.<method or property name> work.

Beginner

Scripts runs all way to end but there is no file saved on following path , we are using office 365 , did anybody have same issue ?

$file = $PSScriptRoot + "\UCS Serial Numbers for "+$UCSList+"_"+$DateFormat+".xlsx"

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards