Collect Service Tags/Serial Numbers using PowerCLI

Here is a useful PowerCLI script to collect Service Tags and Serial Numbers of the servers/blades. If you are maintaining an Inventory or gathering some information about the current hardware in your Datacenter this might be very useful to gather these information.

Run this script in your vCenter server and you will get the similar output as below. I have highlighted the serial numbers of the blades and servers in RED. In UCS you have the Chassis serial number and the blade serial number (right side) in the output.
Create a script after copying the below code and save as a .ps1 file. Execute the script and you get the service tags of your servers. You may need to add your vCenter server IP or FQDN, username and password to this script. Also if you wish to export this to a .csv file add the Exprt-csv pipeline to export to a csv file.

Download the script.

Leave a Reply