# encoding: utf-8
# api: powershell
# title: Get-UcsServerVlan
# description: Uses the Cisco UCS PowerTool (http://developer.cisco.com/web/unifiedcomputing/pshell-download) to list server names, NICs and associated VLANs. Goes well piped out to format-table -auto Server, Vnic, Vlan
# version: 0.1
# type: function
# author: halr9000
# license: CC0
# function: Get-UcsServerVlan
# x-poshcode-id: 3813
# x-archived: 2016-07-04T13:13:01
# x-published: 2013-12-04T08:53:00
#
#
function Get-UcsServerVlan {
Get-UcsServiceProfile | Foreach-Object {
$sp = $_
$sp | Get-UcsVnic | Foreach-Object {
$vn = $_
$vn | Get-UcsVnicInterface | Foreach-Object {
$output = New-Object psobject �property @{
Server = $sp.Name
Vnic = $vn.name
Vlan = $_.name
}
Write-Output $output
}
}
}
}