PoshCode Archive  Artifact [1d3dc670cd]

Artifact 1d3dc670cd06bd2c97e0bd40f4711ff5d3ee687cf0f24a4dcd4ffbd46c2c4c27:

  • File Check-latest-BIOS-Rev.ps1 — part of check-in [0bdf7befed] at 2018-06-10 13:14:11 on branch trunk — This script is pretty simple, it connects to a remote computer and grabs the BIOS class. It then connects to the Dell support page for the remote computer’s ServiceTag. If the computer is a Dell, it grabs the BIOS revision listed on the page. The inspiration came from reading the Scripting Guy blog about comments. (http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/16/add-excellent-comments-to-your-powershell-script.aspx) (user: Jeff Patton size: 2049)

# encoding: ascii
# api: powershell
# title: Check latest BIOS Rev
# description: This script is pretty simple, it connects to a remote computer and grabs the BIOS class. It then connects to the Dell support page for the remote computer’s ServiceTag. If the computer is a Dell, it grabs the BIOS revision listed on the page. The inspiration came from reading the Scripting Guy blog about comments. (http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/16/add-excellent-comments-to-your-powershell-script.aspx)
# version: 0.1
# type: class
# author: Jeff Patton
# license: CC0
# x-poshcode-id: 2677
# x-archived: 2014-12-19T17:57:51
# x-published: 2011-05-17T08:30:00
#
#
$BiosRev = Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName -Credential $Credentials

# Shortened URL for the Dell Support page, fileid=441102, appears to be the identifier for BIOS downloads
# I tested this on a few different models of Dell workstations.

$DellBIOSPage = "http://support.dell.com/support/downloads/download.aspx?c=us&cs=RC956904&l=en&s=hied&releaseid=R294848&SystemID=PLX_960&servicetag=$($BiosRev.SerialNumber)&fileid=441102"

# This HTML code immediately preceed's the actual service tag, you can see it when you 'view source' on the page

$DellPageVersionString = "<span id=`"Version`" class=`"para`">"

If ($BiosRev.Manufacturer -match "Dell")
{
    $DellPage = (New-Object -TypeName net.webclient).DownloadString($DellBIOSPage)
    
    # Assuming that Dell BIOS rev's remain 3 characters, I find where my string starts and add the length to it
    # and the substring returns the BIOS rev.
    
    $DellCurrentBios = $DellPage.Substring($DellPage.IndexOf($DellPageVersionString)+$DellPageVersionString.Length,3)
}

If (($BiosRev.SMBIOSBIOSVersion -eq $DellCurrentBios) -eq $false)
{
    # Something more interesting might go here, perhaps to actually download the latest installer
    
    Write-Host "For the latest bios for $($ComputerName)"
    Write-Host "Please visit $($DellBIOSPage)"
}