Get-UCSServerVlanAudit

Cisco UCS “Get-UCSServerVlanAudit”

In the previous post i explained how I collect information from Cisco UCS hardware using powershell, variables and loops. get-UCSVLAN, get-UCSVLAN

Below is the Function I use to collect the Interface Details from each Cisco UCS Service profile.Get-UCSServerVlanAudit, Get-UCSServerVlanAudit

 

 

 

 

 

 

 

 

 

 

 

This function is the used when connecting to the environment within a loop in powershell.

The script will connect to the UCS POD, create the output files, invoke the command above executing the script, this information is collected in a .csv file with the delimiter set to a “^” symbol rather than a comma. get-UCSserviceprofile, get-UCSserviceprofile

The .csv file is then opened and the “Quotes” are removed ready to be pushed into a Microsoft SQL Database.

 

Script is below Get-UCSServerVlanAudit.

Get-UCSServerVlanAudit, Get-UCSServerVlanAudit

# Create the Foreach Loop for the commands to run
foreach ($UCSPOD in $UCSPODS) {
#connect to the UCS system
$ucsConnection = Connect-Ucs $UCSPOD -Credential $cred

# set the file path and file name
$getUCSSPvNicIntFilePath = $dirRoot + “get-Sp-vNic_” + $ucsconnection.ucs + “.csv”

# Get Service Profile nic Interfaces
Get-UCSServerVlanAudit | Select POD,Server,Vnic,Vlan,Vnet,Addr,SwitchId,DefaultNet,Owner | Export-Csv $getUCSSPvNicIntFilePath -delimiter ^ -notype
#Take out the quotation marks in the CSV files.
(get-content $getUCSSPvNicIntFilePath ) | % {$_ -replace ‘”‘, “”} | out-file $getUCSSPvNicIntFilePath -Fo -En ascii
#—————————————————————-
#disconnect from the system
disconnect-ucs
}