PoshCode Archive  Artifact [0f66047c6a]

Artifact 0f66047c6af515d0a09edde2840230121146dfbadbef0fdb1d9fce496001e7bd:

  • File Get-UcsServerVlan.ps1 — part of check-in [db2530cc5b] at 2018-06-10 13:31:30 on branch trunk — 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 (user: halr9000 size: 977)

# 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
            }
        }
    }
}