tpcarman / As-Built-Report

A collection of PowerShell scripts to generate as built reports on the configuration of datacentre infrastucture in Text, XML, HTML & MS Word formats.
MIT License
88 stars 28 forks source link

Cisco UCS report errors during Blade Server Inventory #59

Closed jhall12 closed 5 years ago

jhall12 commented 5 years ago

Error message with current code

Select-Object : The property cannot be processed because the property "Operability" already exists. At ..\As-Built-Report-dev\Src\Public\Reports\UCS\UCS.ps1:110 char:81

Current Code Operability is defined twice in the code

            $UcsBlade = Get-UcsBlade
            if ($UcsBlade) {
                Section -Style Heading3 -Name 'Blade Server Inventory' {
                    $UcsBlade = $UcsBlade | Sort-Object ChassisID, SlotID | Select-Object @{L = 'Server Id'; E = {$_.ServerId}}, Model, @{L = 'Available Memory'; E = {$_.AvailableMemory}}, @{L = 'Number of CPUs'; E = {$_.NumOfCpus}}, @{L = 'Number of Cores'; E = {$_.NumOfCores}}, 
                    @{L = 'Number of Adapters'; E = {$_.NumOfAdaptors}}, @{L = 'Number of Ethernet Interfaces'; E = {$_.NumOfEthHostIfs}}, @{L = 'Number of FC Host Interfaces'; E = {$_.NumOfFcHostIfs}}, @{L = 'Assigned To'; E = {$_.AssignedToDn}}, Presence, @{L = 'Operability'; E = {$_.OperState}}, 
                        Operability, @{L = 'Power'; E = {$_.OperPower}}, Serial
                    $UcsBlade | Table -Name 'Server Inventory' 
                }
            }

New Code Operability second instance is removed removing the error message without impacting the script function

            $UcsBlade = Get-UcsBlade
            if ($UcsBlade) {
                Section -Style Heading3 -Name 'Blade Server Inventory' {
                    $UcsBlade = $UcsBlade | Sort-Object ChassisID, SlotID | Select-Object @{L = 'Server Id'; E = {$_.ServerId}}, Model, @{L = 'Available Memory'; E = {$_.AvailableMemory}}, @{L = 'Number of CPUs'; E = {$_.NumOfCpus}}, @{L = 'Number of Cores'; E = {$_.NumOfCores}}, 
                    @{L = 'Number of Adapters'; E = {$_.NumOfAdaptors}}, @{L = 'Number of Ethernet Interfaces'; E = {$_.NumOfEthHostIfs}}, @{L = 'Number of FC Host Interfaces'; E = {$_.NumOfFcHostIfs}}, @{L = 'Assigned To'; E = {$_.AssignedToDn}}, Presence, @{L = 'Operability'; E = {$_.OperState}}, 
                        @{L = 'Power'; E = {$_.OperPower}}, Serial
                    $UcsBlade | Table -Name 'Server Inventory' 
                }
            }
tpcarman commented 5 years ago

A new Cisco UCS Manager report is currently in development which addresses this issue.