PoshCode Logo PowerShell Code Repository

Check latest BIOS Rev by Jeff Patton 6 years ago
View followups from Jeff Patton | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/2677"></script>download | new post

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)

  1. $BiosRev = Get-WmiObject -Class Win32_BIOS -ComputerName $ComputerName -Credential $Credentials
  3. # Shortened URL for the Dell Support page, fileid=441102, appears to be the identifier for BIOS downloads
  4. # I tested this on a few different models of Dell workstations.
  6. $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"
  8. # This HTML code immediately preceed's the actual service tag, you can see it when you 'view source' on the page
  10. $DellPageVersionString = "<span id=`"Version`" class=`"para`">"
  12. If ($BiosRev.Manufacturer -match "Dell")
  13. {
  14.     $DellPage = (New-Object -TypeName net.webclient).DownloadString($DellBIOSPage)
  16.     # Assuming that Dell BIOS rev's remain 3 characters, I find where my string starts and add the length to it
  17.     # and the substring returns the BIOS rev.
  19.     $DellCurrentBios = $DellPage.Substring($DellPage.IndexOf($DellPageVersionString)+$DellPageVersionString.Length,3)
  20. }
  22. If (($BiosRev.SMBIOSBIOSVersion -eq $DellCurrentBios) -eq $false)
  23. {
  24.     # Something more interesting might go here, perhaps to actually download the latest installer
  26.     Write-Host "For the latest bios for $($ComputerName)"
  27.     Write-Host "Please visit $($DellBIOSPage)"
  28. }

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

Remember me