PoshCode Archive  Artifact [a83e3e1611]

Artifact a83e3e16117578bb1855669ff208bc0f964ab4c669abb1f4633632aefe141891:

  • File Get-UcsServerVlan.ps1 — part of check-in [716e17d0a3] at 2018-06-10 13:24:55 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: 3391
# x-archived: 2017-05-19T16:42:51
# x-published: 2012-05-02T13:08: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
            }
        }
    }
}