#71452 - 2002-11-07 12:06 AM
Bios Info
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
I'm attempting to do a "model" hardware inventory for my company. I've found that in our maunfactured machines the BIOS carries the model type of the machine, i.e. Toshiba 4030, HP Vectra VL600, etc etc. My main issue is getting a particular portion of information. Example:
SMBIOS -- Version 3.02 (C) Copyright 2000-2002 Qualitas, Inc. All rights reserved. ======================== SMBIOS Header ======================================== SMBIOS header is present at segment F6CFh. SMBIOS Signature: _SM_. SMBIOS Checksum: 37h. SMBIOS Struc Table Length: 31. SMBIOS Revision #: 2.2. SMBIOS Maximum Struc Size: 72. SMBIOS Entry Point Revision: 0. SMBIOS Reserved: 0000000000. DMI Signature: _DMI_. DMI Checksum: 99h. DMI Struc Table Length: 1119. DMI Struc Table Address: 000E0010h. DMI # Strucs: 44. DMI Revision #: 2.2.
══> Type 1: System Information Struc length is 25 bytes. Struc handle is 0001h. Manufacturer: Hewlett-Packard Product Name: HP Vectra Version: VL600 Serial Number: USxxxxxxxxx Universal Unique ID #: D5EB1EC13CDE1xxxxxxxxxxxxxxxxx0 Wake-Up Type: Other
this information is gathered by using SMBIOS.exe V3.02, my problem is I'm still new to scripting at this level and I have no idea on how to get this iformation. My script looks like:
$x = MemorySize() $w = GetDiskSpace (c:\)
; script main Gosub GetWMIInfo Open (2, "\\nt-xxxxx\logs$\HardwareInventory\hardinve.txt", 4) = 0 WriteLine (2, @WKSTA + "," + $WMIManufacturer + "," + $WMIModel + "," + $WMIBiosSernum + "," + $WMICPUCurrentClockSpeed + "," + $x + "," + $w + @CRLF) ;Else ; ? "Failed to open file" Close (2)
;Get $x Exit ; main end
;*************************** ;* sub GetWMIInfo * ;*************************** :GetWMIInfo If @INWIN$ = 1 $WMIManufacturer = Rtrim(WMIQuery("Manufacturer", "Win32_ComputerSystem")) $WMIModel = Rtrim(WMIQuery("Model", "Win32_ComputerSystem")) $WMIBiosVersion = Rtrim(WMIQuery("Version", "Win32_BIOS")) $WMIBiosSernum = Rtrim(WMIQuery("SerialNumber", "Win32_BIOS")) $WMISMBIOSBIOSVersion = Rtrim(WMIQuery("SMBIOSBIOSVersion", "Win32_BIOS")) $WMISMBIOSVersion = Rtrim(WMIQuery("SMBIOSVersion", "Win32_BIOS")) $WMICPUCurrentClockSpeed = Rtrim(WMIQuery("CurrentClockSpeed", "Win32_Processor")) $WMICPUL2CacheSize = Rtrim(WMIQuery("L2CacheSize", "Win32_Processor")) EndIf Return
;*************************** ;* function WMIQuery * ;*************************** Function WMIQuery($what, $where) Dim $strQuery, $objEnumerator, $value $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 AND $objInstance <> "" $junk = Execute("$$value = $$objInstance.$what") $WMIQuery = "$value" + "|" + "$WMIQuery" EndIf Next $WMIQuery = Left($WMIQuery, Len($WMIQuery) - 1) EndFunction
If anyone would be as so kind to take a few minutes and see if they can help me that would be GREAT!!! I'm just hoping I'm not throwing the smallest lawn dart in to the biggest football field, just to hit a penny.
_________________________
penny = the target
the playing field = three football fields side by side
you = only allowed to stand on the outside of the playing field
tool you get to use to find the penny = a ONE INCH LAWN DART
get the level of difficulty?
|
|
Top
|
|
|
|
#71453 - 2002-11-07 12:18 AM
Re: Bios Info
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Does CIM_BIOSElement get you what you want?
See: http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=2;t=003603#000004
quote: CIM_BIOSElement Caption: Default System BIOS CodeSet: Description: Default System BIOS IdentificationCode: InstallDate: LanguageEdition: Manufacturer: Dell Computer Corporation Name: Default System BIOS OtherTargetOS: PrimaryBIOS: -1 SerialNumber: CRYZ601 SoftwareElementID: Default System BIOS SoftwareElementState: Running Status: OK TargetOperatingSystem: 0 Version: Phoenix ROM BIOS PLUS Version 1.10 A12
[ 07. November 2002, 00:19: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#71455 - 2002-11-07 01:04 AM
Re: Bios Info
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
How about this query ArchAngel:
?"$$WMIManufacturer =" Rtrim(WMIQuery("Version", "Win32_ComputerSystemProduct"))
I run an HP VLi8 here at home
-Shawn [ 07. November 2002, 01:05: Message edited by: Shawn ]
|
|
Top
|
|
|
|
#71457 - 2002-11-07 01:49 AM
Re: Bios Info
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
|
|
Top
|
|
|
|
#71461 - 2002-11-07 03:09 PM
Re: Bios Info
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
And here's KiXomatic. It will automatically create a KiX/WMI script for you.
|
|
Top
|
|
|
|
#71465 - 2002-11-07 08:09 PM
Re: Bios Info
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
No now I have a new question... now that I've been staring at this script for the last 3 hours.
I wish to query a specific piece of information, i.e. the NIC Card, disk space total and free on C: only. I'm having a problem limiting the info to just the one item. I've attempted to use if statements but obviously my thinking ins correct. I'm missing some qualifier and I'm not sure what it is or where.....
Example:
$WMICDrive = 0
; script main Gosub GetWMIInfo Open (2, "\\nt-xxxxxx\logs$\HardwareInventory\hardinve.txt", 4) = 0 WriteLine (2, @WKSTA + "," + $WMIManufacturer + "," + $WMIModel + "," + $WMIModelVersion + "," + $WMIBiosSernum + "," + $WMICPUCurrentClockSpeed + "," + $WMITotalPhysicalMemory + "," + $WMICDriveSize + "," + $WMICDriveFreeSpace + "," + $WMIManufacturer2 + "," + $WMIDisplayDescription + "," + $WMINICName + "," + $WMISoundCard + "," + $WMICDRom + @CRLF) ;Else ; ? "Failed to open file" Close (2)
;Get $x Exit ; main end
;*************************** ;* sub GetWMIInfo * ;*************************** :GetWMIInfo If @INWIN$ = 1 $WMIManufacturer = Rtrim(WMIQuery("Manufacturer", "Win32_ComputerSystem")) $WMIModel = Rtrim(WMIQuery("Model", "Win32_ComputerSystem")) $WMIManufacturer2 = Rtrim(WMIQuery("Version", "Win32_ComputerSystemProduct")) $WMIBiosVersion = Rtrim(WMIQuery("Version", "Win32_BIOS")) $WMIBiosSernum = Rtrim(WMIQuery("SerialNumber", "Win32_BIOS")) $WMISMBIOSVersion = Rtrim(WMIQuery("SMBIOSVersion", "Win32_BIOS")) $WMICPUCurrentClockSpeed = Rtrim(WMIQuery("CurrentClockSpeed", "Win32_Processor")) $WMITotalPhysicalMemory = Rtrim(WMIQuery("TotalPhysicalMemory", "Win32_LogicalMemoryConfiguration")) $WMICDrive = Rtrim(WMIQuery("Caption", "Win32_LogicalDisk")) If $WMICDrive = C: $WMICDriveSize = Rtrim(WMIQuery("Size", "Win32_LogicalDisk")) $WMICDriveFreeSpace = Rtrim(WMIQuery("FreeSpace", "Win32_LogicalDisk")) EndIf ;$WMICDriveSize = Rtrim(WMIQuery("Size", "Win32_LogicalDisk")) ;$WMICDriveFreeSpace = Rtrim(WMIQuery("FreeSpace", "Win32_LogicalDisk")) $WMIDisplayDescription = Rtrim(WMIQuery("Description", "Win32_DisplayControllerConfiguration")) $WMINICName = Rtrim(WMIQuery("Caption", "Win32_NetworkAdapterConfiguration")) $WMISoundCard = Rtrim(WMIQuery("Caption", "Win32_SoundDevice")) $WMICDRom = Rtrim(WMIQuery("Caption", "Win32_CDROMDrive")) EndIf Return
;*************************** ;* function WMIQuery * ;*************************** Function WMIQuery($what, $where) Dim $strQuery, $objEnumerator, $value $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 AND $objInstance <> "" $junk = Execute("$$value = $$objInstance.$what") $WMIQuery = "$value" + "|" + "$WMIQuery" EndIf Next $WMIQuery = Left($WMIQuery, Len($WMIQuery) - 1) EndFunction
_________________________
penny = the target
the playing field = three football fields side by side
you = only allowed to stand on the outside of the playing field
tool you get to use to find the penny = a ONE INCH LAWN DART
get the level of difficulty?
|
|
Top
|
|
|
|
#71466 - 2002-11-07 08:13 PM
Re: Bios Info
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
some of the items returned, in your case 'Nic', is that there are multiple items.
try splitting those items with multiple instances
BTW, there is a more current version of WMIQuery than what you have... Not that it would make much difference here.
|
|
Top
|
|
|
|
#71467 - 2002-11-07 08:22 PM
Re: Bios Info
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
code:
$HD =WMIQuery("Size","Win32_DiskDrive") $hdGB =left($hd,len($hd)-9) $hdMBfr =GetDiskSpace("c:")/1000 $Video =WMIQuery("Description","Win32_VideoController") $Printer=WMIQuery("DriverName","Win32_Printer",,"SystemName","@wksta") $modem =WMIQuery("Description","Win32_POTSModem",,"Status","OK") $Biosv =WMIQuery("SMBIOSBIOSVersion","Win32_BIOS") $biosd =WMIQuery("Version","Win32_BIOS") $Make =WMIQuery("Manufacturer","Win32_ComputerSystem") $Model =WMIQuery("Model","Win32_ComputerSystem") select case instr("$model","pro") $case="Desktop" case instr("$model","evo") $case="Desktop" case instr("$model","lat") $case="Laptop" case 1 $case="Not Specified" endselect $asset =WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure") if instr($asset,"|") for each $return in split($asset,"|") if $return $asset=$return endif next endif $SerNo =WMIQuery("SerialNumber","Win32_BIOS") if len($SerNo) < 2 $SerNo=WMIQuery("SerialNumber","Win32_SystemEnclosure") if instr($serno,"|") for each $return in split($serno,"|") if len($return)<10 $serno=$return endif next endif endif $SerNo =trim(ucase($SerNo)) $CPUsp =WMIQuery("CurrentClockSpeed","Win32_Processor") if instr($CPUsp,"179") $CPUsp=1800 endif if instr($CPUsp,"106") $CPUsp=1100 endif if instr($CPUsp,"702") $CPUsp=700 endif $dimms =Split(WMIQuery("Capacity","Win32_PhysicalMemory"),"|") for $a=0 to ubound($dimms) $=execute("$$dimm$a=val($$dimms[$a]) / 1048576") $=execute("$$memory=val($$Memory)+val($$dimm$a)") next
|
|
Top
|
|
|
|
#71470 - 2002-11-07 11:41 PM
Re: Bios Info
|
ArchAngel96
Getting the hang of it
Registered: 2002-10-20
Posts: 70
|
WOOHOO... Thanx to all those who contributed... I can finally see the light!!!!
I finally got the information that I wanted, thanx again for the help. There's still a need for beta and a few more lines to run this only once on the machine, which I do know how to do.... He's the beta form of the script for referance....
;********************************************** ; script main Gosub GetWMIInfo Open (2, "\\ntxxxxxxxx\logs$\HardwareInventory\hardinve.txt", 4) = 0 WriteLine (2, @WKSTA + "," + $WMIManufacturer + "," + $WMIModel + "," + $WMIModelVersion + "," + $WMIManufacturer2 + "," + $WMIBiosSernum + "," + $WMICPUCurrentClockSpeed + "," + $WMITotalPhysicalMemory + "," + $WMICDriveSize + "," + $WMICDriveFreeSpace + "," + $WMIDisplayDescription + "," + $WMINICName + "," + $WMISoundCard + "," + $WMICDRom + @CRLF) ;Else ; ? "Failed to open file" Close (2)
;Get $x Exit ; main end
;*************************** ;* sub GetWMIInfo * ;*************************** :GetWMIInfo If @INWIN$ = 1 $WMIManufacturer = Rtrim(WMIQuery("Manufacturer", "Win32_ComputerSystem")) $WMIModel = Rtrim(WMIQuery("Model", "Win32_ComputerSystem")) $WMIManufacturer2 = Rtrim(WMIQuery("Version", "Win32_ComputerSystemProduct")) $WMIBiosVersion = Rtrim(WMIQuery("Version", "Win32_BIOS")) $WMIBiosSernum = Rtrim(WMIQuery("SerialNumber", "Win32_BIOS")) $WMISMBIOSVersion = Rtrim(WMIQuery("SMBIOSVersion", "Win32_BIOS")) $WMICPUCurrentClockSpeed = Rtrim(WMIQuery("CurrentClockSpeed", "Win32_Processor")) $WMITotalPhysicalMemory = Rtrim(WMIQuery("TotalPhysicalMemory", "Win32_LogicalMemoryConfiguration")) $WMICDrive = Rtrim(WMIQuery("Caption", "Win32_LogicalDisk")) If InStr($WMICDrive,"|") For Each $Return in Split($WMICDrive,"|") If $Return $WMICDrive=$Return EndIf Next EndIf $WMICDriveSize = Rtrim(WMIQuery("Size", "Win32_LogicalDisk")) If InStr($WMICDriveSize,"|") For Each $Return in Split($WMICDriveSize,"|") If $Return $WMICDriveSize=$Return EndIf Next EndIf $WMICDriveFreeSpace = Rtrim(WMIQuery("FreeSpace", "Win32_LogicalDisk")) If InStr($WMICDriveFreeSpace,"|") For Each $Return in Split($WMICDriveFreeSpace,"|") If $Return $WMICDriveFreeSpace=$Return EndIf Next EndIf $WMIDisplayDescription = Rtrim(WMIQuery("Description", "Win32_DisplayControllerConfiguration")) $WMINICName = Rtrim(WMIQuery("Caption", "Win32_NetworkAdapterConfiguration")) If InStr($WMINICName,"|") For Each $Return in Split($WMINICName,"|") If $Return $WMINICName=$Return EndIf Next EndIf $WMISoundCard = Rtrim(WMIQuery("Caption", "Win32_SoundDevice")) $WMICDRom = Rtrim(WMIQuery("Caption", "Win32_CDROMDrive")) If InStr($WMICDRom,"|") For Each $Return in Split($WMICDRom,"|") If $Return $WMICDRom=$Return EndIf Next EndIf EndIf Return
;*************************** ;* function WMIQuery * ;*************************** Function WMIQuery($what, $where) Dim $strQuery, $objEnumerator, $value $strQuery = "Select $what From $where" $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}") $objEnumerator = $SystemSet.ExecQuery($strQuery) For Each $objInstance in $objEnumerator If @Error = 0 AND $objInstance <> "" $junk = Execute("$$value = $$objInstance.$what") $WMIQuery = "$value" + "|" + "$WMIQuery" EndIf Next $WMIQuery = Left($WMIQuery, Len($WMIQuery) - 1) EndFunction
******************************************
Finally have the aim, sort of, with that little lawn dart.
_________________________
penny = the target
the playing field = three football fields side by side
you = only allowed to stand on the outside of the playing field
tool you get to use to find the penny = a ONE INCH LAWN DART
get the level of difficulty?
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 484 anonymous users online.
|
|
|