get-UCSIOM

Cisco UCS “get-UCSIOM”

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

Below is the script I use to collect Blade information from Cisco UCS.

$getUCSIOM = “get-UCSIOM | select AdminPowerState,BaseAddr,ChassisId,ConfigState,Discovery,FeOfflineTs,FeReadyTs,Id,LcName,LcTs,MfgTime,Model,Operability,OperQualifier,PeerCommStatus,PeerDn,Perf,Power,Presence,Revision,Serial,Side,SwitchID,Thermal,UpgradeStatus,UsrLbl,Dn,Voltage,Rn,Status,UCS”

This script 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 expression above executing the script, this information is collected in a .csv file with the delimiter set to a “^” symbol rather than a comma. get-UCSIOM,get-UCSIOM

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

 

Script is below get-UCSIOM

get-UCSIOM,get-UCSIOM

##Powershell Invoke Command
$getUCSIOM = “get-UCSIOM | select AdminPowerState,BaseAddr,ChassisId,ConfigState,Discovery,FeOfflineTs,FeReadyTs,Id,LcName,LcTs,MfgTime,Model,Operability,OperQualifier,PeerCommStatus,PeerDn,Perf,Power,Presence,Revision,Serial,Side,SwitchID,Thermal,UpgradeStatus,UsrLbl,Dn,Voltage,Rn,Status,UCS”
# Create the Foreach Loop for the commands to run
foreach ($UCSPOD in $UCSPODS) {
#connect to the UCS system
$ucsConnection = Connect-Ucs $UCSPOD -Credential $cred

#GET_IOM
#create the file path for exporting IOM data.
$getUCSIOMFilePath = $dirRoot + “get-IOM_” + $ucsconnection.ucs + “.csv”
#get ucs IOM info.
invoke-expression $getUCSIOM | export-csv $getUCSIOMFilePath -delimiter ^ -notype
#Take out the quotation marks in the CSV files.
(get-content $getUCSIOMFilePath ) | % {$_ -replace ‘”‘, “”} | out-file $getUCSIOMFilePath -Fo -En ascii
#—————————————————————-
#disconnect from the system
disconnect-ucs
}