OpenManage-Enterprise icon indicating copy to clipboard operation
OpenManage-Enterprise copied to clipboard

Update-FirmwareUsingCatalog.ps1 more than one page of devices untested

Open grantcurell opened this issue 4 years ago • 0 comments

Right now the following code block is untested:

    elseif ($ComplValList.Length -gt 0) {
        foreach ($ComplianceHash in $ComplValList) {
            $SourcesString = $null
            $NavigationUrlLink = $ComplianceHash.'[email protected]'
            $NavigationURL = "https://$($IpAddress)" + "$NavigationUrlLink"
            $ComponentComplianceReportsResponse = Invoke-WebRequest -Uri $NavigationURL -ContentType $Type `
            -Method GET -SkipCertificateCheck -Credential $Credentials
            if ($ComponentComplianceReportsResponse.StatusCode -eq 200) {
                $ComponentComplianceData = $ComponentComplianceReportsResponse.Content | ConvertFrom-Json
                if ($ComponentComplianceData.'@odata.count' -gt 0) {
                    $ComponentComplianceValue = $ComponentComplianceData.'value' 
                    $Version, $CurrentVersion = Test-Version $ComponentComplianceValue.'Version' `
                    $ComponentComplianceValue.'CurrentVersion'
                    if ($Version -gt $CurrentVersion) {
                        $SourceName = $ComponentComplianceValue.'SourceName'
                        if ($UpdateAction -contains $Component.'UpdateAction') {
                            if ($SourcesString.Length -eq 0) {
                                $SourcesString += $SourceName
                            }
                            else {
                                $SourcesString += ';' + $SourceName
                            }
                        }
                    }
                    if ( $null -ne $SourcesString) {
                        $DeviceComplianceReportHash.'Data' = $SourcesString
                        $DeviceComplianceReportHash.'Id' = $ComplianceHash.'DeviceId'
                        $DeviceComplianceReportTargetList += $DeviceComplianceReportHash
                    }
                }
            }
            else {
                Write-Warning "Compliance reports api call did not succeed...status code returned is not 200"
            }
        }
    }

Testing requires an OME instance with more than a page worth of devices. This block needs to be tested and confirmed to be in working condition.

grantcurell avatar Nov 16 '20 14:11 grantcurell