Re: wim32 class?

Tech-Archive recommends: Fix windows errors by optimizing your registry



First of all, thanks for responding to my question everyone. I delved into
this and stall am having no luck. The SystemChasis and Bios classes do have
a serial number field but I'm not sure what serial number it contains,
doesn't match my system serial number.

I contacted HP tech support and before they gave me the boot, telling me I
had to pay for their services, they let slip that the serial number is
stored in the bios. So I booted up one of my computers here and checked and
sure enough, it's listed right in the bios under system information.
Question now is, how do I read the bios information? The wim32_bios class
doesn't give me anything like this so how do I do it? So far I haven't had
any luck with google or the scripting center.

Thanks again,
Linn

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:%23L3HYixBJHA.3200@xxxxxxxxxxxxxxxxxxxxxxx

"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message
news:uPcdNpuBJHA.1012@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

Is there is a win32 class that returns the serial number of the computer?
I'm writing some scripts to remotely determine the components of a
computer in my network and see the win32_computersystem class returns the
manufacturer and model of the computer but I don't see a property for
serial number. I know it would be up to the manufacturer to enter the
data but figured if it at least existed I could populate it myself if
necessary. I've been looking through the classes but can't seem to locate
anything so far.

I'm working with Windows XP mostly but suspect I'll be forced to move to
Vista sometime in the near future.

Thanks in advance,
Linn


Experience may vary, but I find that the SerialNumber property of the
Win32_SystemEnclosure and Win32_BIOS classes is supported in Vista and
Windows Server 2003 and above. On XP and Windows 2000 clients the values
are not populated. However, you can retrieve a VolumeSerialNumber from the
Win32_LogicalDisk class on all clients with WMI installed. For example:
=========
Option Explicit
Dim strComputer, objWMIService, colItems, objItem

strComputer = InputBox("Enter local computer name", "S/N")

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _
& strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_SystemEnclosure")

For Each objItem In colItems
Wscript.Echo "System S/N: " & objItem.SerialNumber
Next

Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_BIOS")

For Each objItem In colItems
Wscript.Echo "BIOS S/N: " & objItem.SerialNumber
Next

Set colItems = objWMIService.ExecQuery _
("SELECT * FROM Win32_LogicalDisk WHERE Name='C:'")

For Each objItem In colItems
Wscript.Echo "Volume S/N: " & objItem.VolumeSerialNumber
Next
=========
Also, documentation indicates the properties are read-only, so I believe
you cannot write values.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--




.



Relevant Pages

  • Re: wim32 class?
    ... but I find that the SerialNumber property of the ... Dim strComputer, objWMIService, colItems, objItem ... Set colItems = objWMIService.ExecQuery _ ...
    (microsoft.public.windows.server.scripting)
  • Re: wim32 class?
    ... I know it would be up to the manufacturer to enter the ... but I find that the SerialNumber property of the ... Dim strComputer, objWMIService, colItems, objItem ...
    (microsoft.public.windows.server.scripting)
  • Re: Help will empty field entry handling
    ... however some 3rd party oem machines have an empty serial ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ... For Each objItem in colItems ... Wscript.Echo "SerialNumber: no serial number found" ...
    (microsoft.public.scripting.vbscript)
  • Re: WMI - missing serial number?
    ... > the script that is causing the "blank" serial number. ... See if there is a BIOS update form the manufacturer that will "fix" ... > and look for the "SerialNumber" property to see if is blank or null. ... >> Dim Path, WSLSerialNumber ...
    (microsoft.public.scripting.wsh)
  • Re: WMI - missing serial number?
    ... See if there is a BIOS update form the manufacturer that will "fix" this ... and look for the "SerialNumber" property to see if is blank or null. ... Use of included script samples are subject to the terms specified at ... > Set colBIOS = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.wsh)