Powercli and UCS: Report which FI/blade type your hosts are contained in.

In smaller environments this script may not be that great, but what if you have 20 pairs of Fabric Interconnects and 1000 hosts?  Don’t have a good CMDB or are trying to track down which FI your hosts are in to troubleshoot?

Expanding on my last post we will create a new VI property and also dig into the CDP (Cisco Discovery Protocol) to determin which FI your hosts is connected to along with what VCenter.

As part of the script you will need to connect to any and all VCenters with Powercli then run the script below.  It will output: hostname, cluster, version, vcenter build, blade type, and FI name.

New-VIProperty -Name vCenterServer -ObjectType VMHost -Value {$Args[0].Uid.Split(“:”)[0].Split(“@”)[1]} -Force | Out-Null
$date = (get-date).tostring('M-d-y')
Get-VMHost | %{
        $vmhostview = Get-View $_
        $networksystem = Get-view $vmhostview.ConfigManager.NetworkSystem
        $FI = $networksystem.QueryNetworkHint($networksystem.pnic).connectedSwitchPort.systemname[1].split("-")[0] 
        $_ | select Name,Version,Build,Parent,Model,@{Name="Vcenter";Expression={($_ | select vcenterserver).vcenterserver}},@{Name="FI";Expression={$FI}}
        } | Export-Csv -NoTypeInformation master_hostlist-$date.csv

Output will look as follows:

Capture

Advertisements

One Response to Powercli and UCS: Report which FI/blade type your hosts are contained in.

  1. I was searching for a form several days ago and saw a great service with a searchable forms database . If people want it as well , here’s a https://goo.gl/7D9jdL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: