You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there are more than 100 baselines on the OME instance, Get-OMEFirmwareBaseline only return the first 100 firmware baselines.
Suggest to enhance the functionality to retrieve all firmware baselines.
FYI, below is my update for getting all firmware baselines and named as Get-OMEFirmwareBaseline2.ps1 in DellOpenManage\Public\OME folder.
using module ..\..\Classes\FirmwareBaseline.psm1
functionGet-OMEFirmwareBaseline {
<#Copyright (c) 2018 Dell EMC CorporationLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.#><#.SYNOPSIS Get firmware baseline from OpenManage Enterprise.DESCRIPTION Returns all baselines if no input received.PARAMETERValue String containing search value. Use with -FilterBy parameter.PARAMETERFilterBy Filter the results by (Default="Name", "Id").INPUTS String[].EXAMPLE Get-OMEFirmwareBaseline | Format-Table Get all baselines.EXAMPLE "AllLatest" | Get-OMEFirmwareBaseline | Format-Table Get baseline by name#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false,ValueFromPipeline)]
[String[]]$Value,
[Parameter(Mandatory=$false)]
[ValidateSet("Name","Id")]
[String]$FilterBy="Name"
)
Begin {}
Process {
if (!$(Confirm-IsAuthenticated)){
Return
}
Try {
if ($SessionAuth.IgnoreCertificateWarning) { Set-CertPolicy }
$BaseUri="https://$($SessionAuth.Host)"$BaselineUrl=$BaseUri+"/api/UpdateService/Baselines"$Type="application/json"$Headers=@{}
$Headers."X-Auth-Token"=$SessionAuth.Token$BaselineData=@()
$BaselineResp=Invoke-WebRequest-Uri $BaselineUrl-UseBasicParsing -Method Get -Headers $Headers-ContentType $Typeif ($BaselineResp.StatusCode-in200,201) {
$BaselineInfo=$BaselineResp.Content|ConvertFrom-Jsonforeach ($Baselinein$BaselineInfo.'value') {
if ($Value.Count-gt0-and$FilterBy-eq"Id") {
if ([String]$Baseline.Id-eq$Value){
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
elseif ($Value.Count-gt0-and$FilterBy-eq"Name") {
if ($Baseline.Name-eq$Value){
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
else {
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
if ($BaselineInfo.'@odata.nextLink') {
$NextLinkUrl=$BaseUri+$BaselineInfo.'@odata.nextLink'
}
while ($NextLinkUrl) {
Write-Verbose$NextLinkUrl$NextLinkResponse=Invoke-WebRequest-Uri $NextLinkUrl-UseBasicParsing -Method Get -Headers $Headers-ContentType $Typeif ($NextLinkResponse.StatusCode-in200,201) {
$NextLinkData=$NextLinkResponse.Content|ConvertFrom-Jsonforeach ($Baselinein$NextLinkData.'value') {
if ($Value.Count-gt0-and$FilterBy-eq"Id") {
if ([String]$Baseline.Id-eq$Value) {
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
elseif ($Value.Count-gt0-and$FilterBy-eq"Name") {
if ($Baseline.Name-eq$Value) {
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
else {
$BaselineData+=New-FirmwareBaselineFromJson$Baseline
}
}
if ($NextLinkData.'@odata.nextLink') {
$NextLinkUrl=$BaseUri+$NextLinkData.'@odata.nextLink'
}
else {
$NextLinkUrl=$null
}
}
else {
Write-Warning"Unable to get nextlink response for $($NextLinkUrl)"$NextLinkUrl=$null
}
}
return$BaselineData
}
else {
Write-Error"Unable to retrieve Baseline list from $($SessionAuth.Host)"
}
}
Catch {
Resolve-Error$_
}
}
End {}
}
The text was updated successfully, but these errors were encountered:
When there are more than 100 baselines on the OME instance, Get-OMEFirmwareBaseline only return the first 100 firmware baselines.
Suggest to enhance the functionality to retrieve all firmware baselines.
FYI, below is my update for getting all firmware baselines and named as Get-OMEFirmwareBaseline2.ps1 in DellOpenManage\Public\OME folder.
The text was updated successfully, but these errors were encountered: