Get-UCSvNicTempAudit

Cisco UCS “Get-UCSVnicTemplateAudit”

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 vNic Template Details from each Cisco UCS vNic Template.G

Get-UCSvNicTempAudit Get-UCSvNicTempAudit

 

 

 

 

 

 

 

 

 

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-UCSvNicTempAudit.

Get-UCSvNicTempAudit Get-UCSvNicTempAudit

# 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
$getUCSvNicTemplVlansFilePath = $dirRoot + “get-vNicTmp_” + $ucsconnection.ucs + “.csv”
# Get Vnic Template Audit
Get-UCSvNicTempAudit | Select UCS_POD,vNicTemplateName,VlanName, VlanAssigned | export-csv $getUCSvNicTemplVlansFilePath -delimiter ^ -notype
#Take out the quotation marks in the CSV files.
(get-content $getUCSvNicTemplVlansFilePath ) | % {$_ -replace ‘”‘, “”} | out-file $getUCSvNicTemplVlansFilePath -Fo -En ascii
#—————————————————————-
#disconnect from the system
disconnect-ucs
}