Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > wim32 class?

Reply
 
 
Linn Kubler
Guest
Posts: n/a

 
      08-25-2008
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


 
Reply With Quote
 
 
 
 
J Ford
Guest
Posts: n/a

 
      08-25-2008
You can use Win32_SystemEnclosure or Win32_Bios

"Linn Kubler" wrote:

> 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
>
>
>

 
Reply With Quote
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      08-26-2008

"Linn Kubler" <> wrote in message
news:...
> 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,authenticationLev el=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
--


 
Reply With Quote
 
J Ford
Guest
Posts: n/a

 
      08-26-2008
That's true, greatly depends on the HW Manufactuer

"Richard Mueller [MVP]" wrote:

>
> "Linn Kubler" <> wrote in message
> news:...
> > 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,authenticationLev el=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
> --
>
>
>

 
Reply With Quote
 
Hal Rottenberg
Guest
Posts: n/a

 
      08-26-2008
Linn Kubler wrote:
> 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


PowerShell example:

§ ATLLAPHROTTENBE {~} Get-WmiObject win32_bios

SMBIOSBIOSVersion : A08
Manufacturer : Dell Inc.
Name : Phoenix ROM BIOS PLUS Version 1.10 A08
SerialNumber : 7B530C1
Version : DELL - 27d70403

If you want to grab just the s/n of a bunch of computers which are in a file:

$computers = get-content computers.txt
$results = get-wmiobject win32_bios -computer $computers
$results | select SerialNumber

--
Author, Tech Prosaic blog (http://halr9000.com)
Webmaster, Psi (http://psi-im.org)
Community Director, PowerShellCommunity.org
Co-host, PowerScripting Podcast (http://powerscripting.net)
 
Reply With Quote
 
Linn Kubler
Guest
Posts: n/a

 
      08-26-2008
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-> wrote in
message news:%...
>
> "Linn Kubler" <> wrote in message
> news:...
>> 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,authenticationLev el=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
> --
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does windows vista supports AVstream Class & Stream class drivers? darshan.tapdia@gmail.com Windows Vista Drivers 1 06-29-2006 10:54 AM
Error code 80040111, Class Factory cannot supply requested class suicide_boy Windows Media Player 3 05-29-2004 10:08 PM
Media Player Error:Class Factory cannot supply requested class jimbo Windows Media Player 0 05-18-2004 05:36 AM
RE: Failed to play a mp3 song:Class factory failes to supply class tahir Windows Media Player 0 04-07-2004 03:41 PM
Is AVStream class backward compatible to stream class for DirectX filter? Jackal Huang Windows Vista Drivers 1 02-25-2004 12:48 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59