Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for biosinfo.kix

(view source code of biosinfo.kix as plain text)

  1. ; Online help requested?
  2. If $help
  3. 	Syntax
  4. EndIf
  5.  
  6. ; Connect to computer's WMI service
  7. $objWMIService = GetObject( "winmgmts://./root/cimv2" )
  8. ; Display error number and description if applicable
  9. If @ERROR
  10. 	ShowError()
  11. EndIf
  12.  
  13. ; Collect BIOS information
  14. $colItems = $objWMIService.ExecQuery( "Select * from Win32_BIOS where PrimaryBIOS = true", , 48 )
  15. ; Display error number and description if applicable
  16. If @ERROR
  17. 	ShowError()
  18. EndIf
  19.  
  20. ; To retrieve the BIOS release date we have
  21. ; to revert to good old DEBUG techniques
  22.  
  23. ; Create temporary DEBUG script
  24. $kxCrLf = Chr(13) + Chr(10)
  25. $dbg = "D FFFF:0005 L 8" + $kxCrLf + "Q" + $kxCrLf
  26. $rc = RedirectOutput( "biosdate.dbg" )
  27. "$dbg"
  28. $rc = RedirectOutput( "" )
  29.  
  30. ; Run DEBUG script and store output in a temporary file
  31. Shell "DEBUG.EXE < biosdate.dbg > biosdate.dat"
  32.  
  33. If Open( 3, "biosdate.dat" ) = 0
  34. 	$line = ReadLine( 3 )
  35. 	While @Error = 0
  36. 		$biosdate = $biosdate + SubStr( $line, 67 )
  37. 		$line     = ReadLine(3)
  38. 	Loop
  39. 	$rc = Close( 3 )
  40. Else
  41. 	? "Error reading temporary file, error code: [@Error]"
  42. 	Syntax
  43. EndIf
  44.  
  45. ; Remove the temporary DEBUG script
  46. Del "biosdate.dat"
  47. Del "biosdate.dbg"
  48.  
  49. ; Display the results
  50. ; Header line for screen output
  51. ? "BIOS summary for @WkSta:"
  52.  
  53. ; Prepare collected info for display
  54. For Each $objItem in $colItems
  55. 	? "    BIOS Name       :  " + $objItem.Name
  56. 	? "    Version         :  " + $objItem.Version
  57. 	? "    Release date    :  " + $biosdate
  58. 	? "    Manufacturer    :  " + $objItem.Manufacturer
  59. 	? "    SMBIOS Version  :  " + $objItem.SMBIOSBIOSVersion
  60. 	?
  61. Next
  62.  
  63. ; Done
  64. Quit 0
  65.  
  66.  
  67. Function ShowError()
  68. 	? "Error # @ERROR"
  69. 	?
  70. 	Syntax
  71. EndFunction
  72.  
  73.  
  74. Function Syntax()
  75. 	? "BIOSInfo.kix,  Version 1.00"
  76. 	? "Display BIOS information for any WMI enabled computer on the network."
  77. 	?
  78. 	? "Usage:  KIX32  BIOSINFO.KIX  [ $$help=1 ]"
  79. 	?
  80. 	? "This script uses DEBUG.EXE to read the BIOS release date and WMI for the rest"
  81. 	?
  82. 	? "Written by Rob van der Woude"
  83. 	? "http://www.robvanderwoude.com"
  84. 	?
  85. 	; Abort with return code 1
  86. 	Quit 1
  87. EndFunction
  88.  

page last modified: 2024-04-16; loaded in 0.0199 seconds