• RSS
  • Twitter
21
September
Comments

Scenario: I was in the process of building a CMDB, and I needed to gather Dell Service Tag’s for my host machines.  I did a little of internet searching and couldn’t really find anything specifically for Dell Blades.  So to that effect here we all are today so: Game On!

Note: My experience and code is in reference only to the Dell E1000 chassis and M-Blade series.  So your mileage may vary depending on your equipment.

Now What?: We do the smart thing and break down our process logically; however, the first thing we need to do is understand where Service Tag property lives.  Lucky for you, Dear Reader, not only have I done this work for you I’ll give you the special syntax that makes the rest of this script magic.

Now that the mighty magic bullet is locked and loaded let’s break down the rest of our logic.

  1. Go ahead and Connect-Viserver that you want to grad service tags for.  This part isn’t going to be in our script.
  2. Not only will we Get-VMHost, but we will also have to Get-View for all of our host machines.  Let’s make sure we do this in -Verbose mode; because, if you have more than a handful of hosts this process can take a very long time, and tractability could be a good thing at this point.
  3. Create a couple of powershell array lists for organizational purposes.
  4. Create a variable for tracking due to non-multidimensional arrays.
  5. Give us the output.

One other tidbit of advice: If you are looking to quickly identify what chassis your blade is in you only have to change the IdentifierValue from a 1 to a 0.  Additionally, in the PowerCLI code below change $j from a 1 to a 0.

Let’s Get To Work!: For the sake of not having to explain our steps that we have listed above you can find the PowerCLI code in full below.

One other note of interest.  If you are like me and have a rather large environment you may want to export your $VMReport to a CSV.  If this is the case feel free to add this portion of code as your last line in your script.

Closing Thoughts: PowerCLI makes the most tedious tasks tolerable and even challenging.  Moreover, VMware has done a great job providing visualization professionals with the tools that they need in order to automate nearly any task.

About the author

@VirtualizedCJ

CJ is a virtualization professional that loves automation — maybe a little to much.

Categories: Scripts

Leave a Reply