Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

Having trouble with foreach loops

$
0
0

After a great deal of research, failed prototypes, and an excess of caffeine and nicotine, I found the commands I needed for pulling the 'ServiceTag' / 'SerialNumber' from my ESXi hosts in vSphere 5.0 - 5.5.  As an example:

$esxcli = Get-Esxcli -VMHost <host name> -V2

$esxcli.hardware.platform.get.Invoke().SerialNumber

 

This formula makes up the script for getting that tag/serial number for that one host.  I must be brain dead today because I'm traveling in a few hours by car for about 3 hours - very mind numbing without music.  I can't seem to figure out the correct way to set it up to so that I get that information from each of the hosts in a vCenter.  For this exercise, I have 19 hosts, all UCS created, but they have their own tag as well.

 

Can anyone guide me towards the proper syntax for a foreach loop to perform my little script above?

 

Thanks in advance as always


Viewing all articles
Browse latest Browse all 175326

Trending Articles