Page 1 of 1 1
Topic Options
#71452 - 2002-11-07 12:06 AM Bios Info
ArchAngel96 Offline
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 Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#71454 - 2002-11-07 12:38 AM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Unfortunetly, I don't see the information there. It might also be the type of mchine you ran you test on, we do have some variations in the type of machines. For instance, if I were to run "my" script on a toshiba laptop it gathers the information I need. I'm having a problem on iur HP Desktop vectra lines. Their exact model information is in a different area, the Version: VL600 Version: VL600 is the exact area. But thanx for your attempt, it still was usefull.
_________________________
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
#71455 - 2002-11-07 01:04 AM Re: Bios Info
Shawn Administrator Offline
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 [Wink]

-Shawn

[ 07. November 2002, 01:05: Message edited by: Shawn ]

Top
#71456 - 2002-11-07 01:33 AM Re: Bios Info
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You might want to grab a WMI Object Browser and check the various computers you have. Download the WMI SDK to get a browser ane check out KiXomatic.
_________________________
There are two types of vessels, submarines and targets.

Top
#71457 - 2002-11-07 01:49 AM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
WOOHOO!!!!! [Big Grin] [Cool] Shawn has the perfect aim with the lawn dart!!!!!!! Thanx Shawn!!! that was the one piece that escaped me. Now to test it on the other models to see the results.

Thank you all that tried their luck, but Shawn seems to be the sharp shooter here... [Wink]
_________________________
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
#71458 - 2002-11-07 03:07 AM Re: Bios Info
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should really fire up a WMI Object Browser and let yourself surprise as to the amount of info present in WMI. Shawn just touched the tip of the (SystemBIOS) iceberg.
_________________________
There are two types of vessels, submarines and targets.

Top
#71459 - 2002-11-07 03:41 AM Re: Bios Info
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK Jens, you keep talking about a WMI Browser... so what browser do you suggest?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#71460 - 2002-11-07 03:46 AM Re: Bios Info
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I'm using the one included in Microsoft's WMI SDK, available at http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/msdn-files/027/001/566/msdncompositedoc.xml
_________________________
There are two types of vessels, submarines and targets.

Top
#71461 - 2002-11-07 03:09 PM Re: Bios Info
Chris S. Offline
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. [Big Grin]
Top
#71462 - 2002-11-07 07:56 PM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
You all are just out to get me introuble.... So I took a look at the KixOmatic and thats pretty SWEET!!!!! But now that I know how to get some of these "areas", I just need to figure out how to query the specific [Confused] additional [Mad] areas that "we'd" like for the inventory.

Gee Thanx...
_________________________
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
#71463 - 2002-11-07 08:00 PM Re: Bios Info
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Told you so [Big Grin]
_________________________
There are two types of vessels, submarines and targets.

Top
#71464 - 2002-11-07 08:03 PM Re: Bios Info
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The code generated from Kix-o-matic would be a great start, plus Radimus's WMIQuery is pretty much plug-and-play.
Top
#71465 - 2002-11-07 08:09 PM Re: Bios Info
ArchAngel96 Offline
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 Offline
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.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#71467 - 2002-11-07 08:22 PM Re: Bios Info
Radimus Moderator Offline
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

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#71468 - 2002-11-07 08:51 PM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
I see what you're saying there... but if the machine has more than one hard drive, we only care about C:, most of our users get confused that there are network drives. And for the nic its pulling the serial and parellel information too. I can't see how to isolate it down to one option. I'm thinking it has to be told in the GetWMIInfo section but don't see how to isolate it down.

Sorry folks, I do appreciate all your help. WMI is just a little more than I'm capable of right now, but it seems to be the only way to get the info I need. My bigger issue is that this script will hit 1700 machines, so I need to make sure I get it right the first time... But thanx for all your efforts and of course any one who still attempts to help.
_________________________
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
#71469 - 2002-11-07 09:38 PM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
Well, of course there's going to be a test group.... I may be new to the whole world of scripting.... but I'm an old dog on "rollout".... give me some credit...
_________________________
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
#71470 - 2002-11-07 11:41 PM Re: Bios Info
ArchAngel96 Offline
Getting the hang of it

Registered: 2002-10-20
Posts: 70
WOOHOO... Thanx to all those who contributed... I can finally see the light!!!! [Wink]

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.... [Smile] 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
#71471 - 2002-11-08 01:42 AM Re: Bios Info
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
However, it would be nice if you would post your code between [CODE] tags as specified in ABC's of KiXtart board etiquette and message to new forum users
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.069 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org