Page 1 of 2 12>
Topic Options
#69200 - 2002-08-20 05:11 PM Log Dell Service Tag (a little bit off-topic)
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hi all,

We use a lot of Dell computers at our site. I'd like to be able to log the computername and the corresponding Dell Service Tag. Does anyone know how to do this? The Dell tool asset.com seems not to be able to work in Windows... ?
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#69201 - 2002-08-20 05:16 PM Re: Log Dell Service Tag (a little bit off-topic)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should be able to retrieve it with either SMBIOS or WMI. However, I do not have any scritps avaialble to do this. Fire up a WMI browser and search for the Dell Service Tag property.
_________________________
There are two types of vessels, submarines and targets.

Top
#69202 - 2002-08-20 05:27 PM Re: Log Dell Service Tag (a little bit off-topic)
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Jeroen...
I have lots of Dells. This works for me.

code:
$machine=@wksta
? "Computer Name = "+$machine
? "IdentifyingNumber = "WMIQuery("IdentifyingNumber","Win32_ComputerSystemProduct","$machine")
? "Name = "WMIQuery("Name","Win32_ComputerSystemProduct","$machine")
? "Vendor = "WMIQuery("Vendor","Win32_ComputerSystemProduct","$machine")
FUNCTION WMIQuery($what,$where, optional $computer)
dim $strQuery, $objEnumerator, $value
if not $computer $computer="@WKSTA" endif
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
ENDFUNCTION

_________________________
We all live in a Yellow Subroutine...

Top
#69203 - 2002-08-20 08:52 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I use
code:
	$Make =WMIQuery("Manufacturer","Win32_ComputerSystem")
$Model=WMIQuery("Model","Win32_ComputerSystem")
$SerNo=WMIQuery("SerialNumber","Win32_BIOS")
if $SerNo < " "
$SerNo=WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
endif

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

Top
#69204 - 2002-08-20 09:03 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Waltz... I just did some looking around at the Win32_ComputerSystemProduct key you provided, and I found something interesting.

That info appears to be static from the time of install, I was looking through a Latitude notebook WMI at that key and it is filled in with the info from the compaq deskpro that was used to master the image that was applied to my laptops (and other desktops)...

You may want to look into that.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#69205 - 2002-08-21 09:38 AM Re: Log Dell Service Tag (a little bit off-topic)
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hmm? I can't seem to get it to work... Is it dependant on some external factor? I just copied and pasted it to a kix script, and ran it with kix. What am I missing? (I copied the WMIQuery function also). Will I need to use a newer version than Kix 3.63 ?
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#69206 - 2002-08-21 01:29 PM Re: Log Dell Service Tag (a little bit off-topic)
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Yes, you'll need to update. WMIQuery is a "User-defined function" which is not supported by the version of KiX you are using.
Top
#69207 - 2002-08-21 02:10 PM Re: Log Dell Service Tag (a little bit off-topic)
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Ok, did that, now working with 4.10.. But I still get no result. I'm now using:

code:
Break on

$Tag = WMIQuery("SerialNumber","Win32_BIOS")
If LEN($Tag) < 2
$Tag = WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
Endif

Cls
At (3,3) "Service Tag : $Tag"
Get $
Exit

FUNCTION WMIQuery($what,$where, optional $computer)
dim $strQuery, $objEnumerator, $value
if not $computer $computer="@WKSTA" endif
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
ENDFUNCTION

What am I doing wrong?
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#69208 - 2002-08-21 02:14 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
WMI is built into win2k+ and NT SP4+ (and WinMe [Frown] ) if you have win9x you will need to install WMI on them.

Go through the WMIQuery() post for details.

Also, not ALL Dells have asset tags/serial numbers. Many Do, but not all.... depends on Make/Model/Bios version

[ 21. August 2002, 14:15: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#69209 - 2002-08-21 03:15 PM Re: Log Dell Service Tag (a little bit off-topic)
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hi again,

I'm using a Dell GX150 myself, which has a Service Tag number. (and I'm able to read it using asset.com via MSDOS). My system uses NT4 SP6a, but just to be sure, I installed the update I found at Microsoft, which installs WMI on Win9x, and NT4. I still couldn't get the script to work though, are you sure it should work the way my code is? Does it work on your PC? (if you have a Dell)?
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#69210 - 2002-08-21 03:56 PM Re: Log Dell Service Tag (a little bit off-topic)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If you say you can't get it to work then please provide whether it generates an error code, or whether it reads the information correctly. Also, run it in DEBUG mode and see where it is going wrong.
_________________________
There are two types of vessels, submarines and targets.

Top
#69211 - 2002-08-21 05:43 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
this code

code:
:Hardware
$CPUsp =@mhz
$Memory =Memorysize(0) +1
$Modem =WMIQuery("Description","Win32_POTSModem")
$HD =WMIQuery("Size","Win32_DiskDrive")
$hdGB =left($hd,len($hd)-9)
$Make =WMIQuery("Manufacturer","Win32_ComputerSystem")
$Model =WMIQuery("Model","Win32_ComputerSystem")
$Biosv =WMIQuery("SMBIOSBIOSVersion","Win32_BIOS")
$biosd =WMIQuery("Version","Win32_BIOS")
$SerNo =WMIQuery("SerialNumber","Win32_BIOS")
if len($SerNo) < 2
$SerNo=WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
endif
select
case instr("$model","deskpro") $case="Desktop"
case instr("$model","evo") $case="Desktop"
case instr("$model","latitude") $case="Laptop"
case 1 $case="Not Specified"
endselect

? color c+/n " Computer Model: " color w+/n "$Make $Model $case" color w/n
? color w/n " " color w+/n trim(@CPU)" / $memory MB / $hdGB GB" color w/n
? color c+/n " Serial Number: " color w+/n $SerNo color w/n

return

generates this return... the UDF hasn't been altered.

code:
Determining Computer Hardware...
Computer Model: Compaq Evo D500 Desktop
Intel(R) Pentium(R) 4 CPU 1.80GHz / 512 MB / 20 GB
Serial Number: V526JYFYB689

If you still have problems, search for the WMI Object Browser. I can't remember where on MS's Site it was, but it will help you examing your system's WMI DB to locate your data.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#69212 - 2002-08-21 06:06 PM Re: Log Dell Service Tag (a little bit off-topic)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I believe the WMI Object Browser is part of the WMI SDK.
_________________________
There are two types of vessels, submarines and targets.

Top
#69213 - 2002-08-21 06:41 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Has anyone tried writing to WMI?

I need to write to "SMBIOSAssetTag" in "Win32_SystemEnclosure"
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#69214 - 2002-08-21 06:45 PM Re: Log Dell Service Tag (a little bit off-topic)
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You can look up in the WMI SDK whether a perticular item is writable. Following is the entry for Win32_SystemEnclosure, unfortunately they are all read-only.

quote:

Win32_SystemEnclosure
The Win32_SystemEnclosure WMI class represents the properties associated with a physical system enclosure.

Properties
The following table lists the properties for Win32_SystemEnclosure.

Property Description
AudibleAlarm Boolean
Read-only
Indicates whether the frame is equipped with an audible alarm.

BreachDescription string
Read-only
Free-form string providing more information if the SecurityBreach property indicates that a breach or some other security-related event occurred.

CableManagementStrategy string
Read-only
Free-form string that contains information on how the various cables are connected and bundled for the frame. With many networking, storage-related, and power cables, cable management can be a complex and challenging endeavor. The property contains information to aid in assembly and service of the frame.

Caption string
Read-only
Short description (one-line string) of the object.

ChassisTypes array (uint16)
Read-only
List of chassis types.

Values are:
1 = Other
2 = Unknown
3 = Desktop
4 = Low Profile Desktop
5 = Pizza Box
6 = Mini Tower
7 = Tower
8 = Portable
9 = Laptop
10 = Notebook
11 = Hand Held
12 = Docking Station
13 = All in One
14 = Sub Notebook
15 = Space-Saving
16 = Lunch Box
17 = Main System Chassis
18 = Expansion Chassis
19 = SubChassis
20 = Bus Expansion Chassis
21 = Peripheral Chassis
22 = Storage Chassis
23 = Rack Mount Chassis
24 = Sealed-Case PC

CreationClassName string
Read-only
Qualifiers: Key, MaxLen(256)
Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified.

CurrentRequiredOrProduced sint16
Read-only
Current required by the chassis at 120V. If power is provided by the chassis (as in the case of a UPS), this property may indicate the amperage produced (as a negative number).

Depth real32
Read-only
Depth of the physical package in inches.

Description string
Read-only
Description of the object.

HeatGeneration uint16
Read-only
Amount of heat generated by the chassis in BTU/hour.

Height real32
Read-only
Height of the physical package in inches.

HotSwappable Boolean
Read-only
Indicates whether a physical package can be hot swapped (if it is possible to replace the element with a physically different but equivalent one while the containing package has power applied to it). For example, a disk drive package inserted using SCA connectors is removable and can be hot-swapped. All packages that can be hot-swapped are inherently removable and replaceable.

InstallDate datetime
Read-only
When the object was installed. A lack of a value does not indicate that the object is not installed.

LockPresent Boolean
Read-only
Indicates whether the frame is protected with a lock.

Manufacturer string
Read-only
Name of the organization responsible for producing the physical element.

Model string
Read-only
Name by which the physical element is generally known.

Name string
Read-only
Label by which the object is known. When subclassed, the property can be overridden to be a key property.

NumberOfPowerCords uint16
Read-only
Number of power cords which must be connected to the chassis, for all the components to operate.

OtherIdentifyingInfo string
Read-only
Additional data, beyond asset tag information, that could be used to identify a physical element. One example is bar code data associated with an element that also has an asset tag. Note that if only bar code data is available and is unique/able to be used as an element key, this property would be NULL and the bar code data used as the class key, in the tag property.

PartNumber string
Read-only
Part number assigned by the organization responsible for producing or manufacturing the physical element.

PoweredOn Boolean
Read-only
Indicates whether the physical element is powered on.

Removable Boolean
Read-only
Indicates whether a physical package is removable (if it is designed to be taken in and out of the physical container in which it is normally found, without impairing the function of the overall packaging). A package can still be removable if power must be 'off' in order to perform the removal. If power can be 'on' and the package removed, then the element is removable and can be hot-swapped. For example, an extra battery in a laptop is removable, as is a disk drive package inserted using SCA connectors. However, the latter can be hot swapped. A laptop's display is not removable, nor is a non-redundant power supply. Removing these components would affect the function of the overall packaging or is impossible due to the tight integration of the package.

Replaceable Boolean
Read-only
Indicates whether a physical package is replaceable (if it is possible to replace -- FRU or upgrade -- the element with a physically different one). For example, some computer systems allow the main processor chip to be upgraded to one of a higher clock rating. In this case, the processor is said to be replaceable. Another example is a power supply package mounted on sliding rails. All removable packages are inherently replaceable.

SecurityBreach uint16
Read-only
Status of a physical breach of the frame.

Values are:
1 = Other
2 = Unknown
3 = No Breach
4 = Breach Attempted
5 = Breach Successful

SecurityStatus uint16
Read-only
Security setting for external input (such as a keyboard) to this computer.

Values are:
1 = Other
2 = Unknown
3 = None
4 = External interface locked out
5 = External interface enabled


SerialNumber string
Read-only
Manufacturer-allocated number used to identify the physical element.

ServiceDescriptions array (string)
Read-only
More detailed explanations for any of the entries in the ServicePhilosophy array. Note, each entry of this array is related to the entry in ServicePhilosophy that is located at the same index.

ServicePhilosophy array (uint16)
Read-only
List that includes whether the frame is serviced from the top, front, back, or side; whether it has sliding trays or removable sides; and whether the frame is moveable (for example, having rollers).

Values are:
0 = Unknown
1 = Other
2 = Service From Top
3 = Service From Front
4 = Service From Back
5 = Service From Side
6 = Sliding Trays
7 = Removable Sides
8 = Moveable

SKU string
Read-only
Stock-keeping unit number for the physical element.

SMBIOSAssetTag string
Read-only
Asset tag number of the system enclosure.


Status string
Read-only
Current status of the object. Various operational and non-operational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard drive, may be functioning properly but predicting a failure in the near future). Non-operational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is on-line, yet the managed element is neither "OK" nor in one of the other states.

Values are:
"OK"
"Error"
"Degraded"
"Unknown"
"Pred Fail"
"Starting"
"Stopping"
"Service"

Tag string
Read-only
Qualifiers: Key, MaxLen(256)
Uniquely identifies the system enclosure.

Example: "System Enclosure 1"


TypeDescriptions array (string)
Read-only
More information on the ChassisTypes array entries. Note, each entry of this array is related to the entry in ChassisTypes that is located at the same index.

Version string
Read-only
Version of the physical element.

VisibleAlarm Boolean
Read-only
Indicating whether the equipment includes a visible alarm.

Weight real32
Read-only
Weight of the physical package in pounds.

Width real32
Read-only
Width of the physical package in inches.


Methods
The following table lists the method for Win32_SystemEnclosure.

Method Description
IsCompatible Class method that verifies whether the referenced physical element may be contained by or inserted into the physical package.

Remarks
The Win32_SystemEnclosure class is derived from CIM_Chassis.

See Also
Computer System Hardware Classes


_________________________
There are two types of vessels, submarines and targets.

Top
#69215 - 2002-08-21 09:41 PM Re: Log Dell Service Tag (a little bit off-topic)
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
dell seems to hide the serial number here:
$SerNo=WMIQuery("SerialNumber","Win32_SystemEnclosure")

and the asset tags are here:
$asset =WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#69216 - 2002-08-21 10:00 PM Re: Log Dell Service Tag (a little bit off-topic)
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Radimus...

Good detective work on the Win32_ComputerSystemProduct key info.
My machine is a dev box that was imaged 'differently'. I'll have to look into this further, when I get a chance. There is clearly redundancy in the data stored; the real trick is to find what WMI item works in a given environment.
Cheers,
_________________________
We all live in a Yellow Subroutine...

Top
#69217 - 2002-08-22 12:24 AM Re: Log Dell Service Tag (a little bit off-topic)
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
Only to say that the code here posted (and the additions) do work on my DELL Latitude C810.

The complete code I run was this:

code:
$machine=@wksta
? "Computer Name = " + $machine
? "IdentifyingNumber = " + WMIQuery("IdentifyingNumber","Win32_ComputerSystemProduct","$machine")
? "Name = " + WMIQuery("Name","Win32_ComputerSystemProduct","$machine")
? "Vendor = " + WMIQuery("Vendor","Win32_ComputerSystemProduct","$machine")
? "SerNo = " + WMIQuery("SerialNumber","Win32_SystemEnclosure")
? "Asset TAG = " + WMIQuery("SMBIOSAssetTag","Win32_SystemEnclosure")
?
get $lix ; pause

function WMIQuery($what,$where, optional $computer)
dim $strQuery, $objEnumerator, $value
if not $computer
$computer="@WKSTA"
endif
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
for each $objInstance in $objEnumerator
if @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
endif
next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
endfunction

Only thing I can't say for sure is the Asset Tag, wich displays nothing here, but then again, I don't recall if I set anything for that in the BIOS... [Smile]

On my PC it goes like this (some values edited!)
code:
Computer Name     = PC_NAME
IdentifyingNumber = 6KFJ81L
Name = Latitude C810
Vendor = Dell Computer Corporation
SerNo = 6KFJ81L
Asset TAG =

Bye,
Fernando Madruga
_________________________
Later,   [b]Mad[/b]ruga

Top
#69218 - 2002-08-22 10:47 AM Re: Log Dell Service Tag (a little bit off-topic)
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Fernando,

I just tried yours, and it works great! Thanks a lot ! I'll look in to the WMI browser bit, might be interesting for some other data as well. To all others who tried to help also; thanks for all the trouble !
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#69219 - 2002-08-22 08:58 PM Re: Log Dell Service Tag (a little bit off-topic)
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
Radimus, I've tried using that script and it errors out in the "identifyingnumber" area. I'm running this script on a Win2k machine. Is there something that I'm missing here? I'm using the latest version of Kixtart. Do WMI queries only work on older versions of Kix or something? Surely not?
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 1170 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.076 seconds in which 0.026 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