param (
[string]$Platform
)
# Check if platform provided
if ($Platform) {
$platform = $platform.ToUpper()
}
else {
$params = @{
ClassName = 'Win32_BaseBoard'
Namespace = 'root\cimv2'
}
$obj = Get-CimInstance @params -ErrorAction stop
$platform = $obj.Product.ToUpper()
}
# Get BIOS Info from HP web site
$uri = [string]"$Url/{0}/{0}.xml" -f $platform
$data = Invoke-WebRequest -Uri $uri
[xml]$doc = [System.IO.StreamReader]::new($data.RawContentStream).ReadToEnd()
$refined_doc = $doc.SelectNodes("//BIOS/Rel") | Select-Object -Property @{ Name = 'Ver'; expr = { $_.Ver.TrimStart("0") } },'Date','Bin','RB','L','DP' | Sort-Object -Property Ver -Descending
$LatestBIOS = $refined_doc[0]
Write-Output $LatestBIOS
}
Example 2: Get-BIOSUpdate -Platform "854A"