Find Serial number by using wmic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to use wmic.exe to find the serial number of the a computer is
this possibel?
if not is there any other soulution that is easy to use?
 
Yes, you are looking for information from SMBIOS. Take a look on MSDN for
WMI classes available. If you can't find it, let me know and I'll try to
write up something.
 
I found a lot of info on different wmi keys but haven't figured out how I can
acutally get the information out into a text file.

If there is some document that explains the syntax and what type of script
file or program I can use to get that info out.
Thanks for the help.
 
hans said:
I found a lot of info on different wmi keys but haven't figured out how I can
acutally get the information out into a text file.

If there is some document that explains the syntax and what type of script
file or program I can use to get that info out.
Thanks for the help.
Hi,

With VBScript:

'--------------------8<----------------------
Const OverwriteIfExist = -1
Const OpenAsASCII = 0

' File that result will be written to
strOutFile = "C:\SerialNr.txt"

Set objFSO = CreateObject("Scripting.FileSystemObject")

strComputer = "." ' use "." for local computer

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

Set colBIOS = objWMIService.ExecQuery _
("Select * from Win32_BIOS")

For Each objBIOS in colBIOS
strSerialNr = objBIOS.SerialNumber
Next

' Create file
Set fOutFile = objFSO.CreateTextFile(strOutFile, _
OverwriteIfExist, OpenAsASCII)

fOutFile.WriteLine strSerialNr
fOutFile.Close
'--------------------8<----------------------


Here are some WSH starting points:

WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp


Welcome to the Script Center
http://www.microsoft.com/technet/scriptcenter/default.mspx

The updated Portable Script Center (v3.0), the *.chm version of all of
the sample scripts on the TechNet Script Center site...

Download details: System Administration Scripting Guide Scripts
http://www.microsoft.com/downloads/...familyid=b4cb2678-dafb-4e30-b2da-b8814fe2da5a


For a list of some scripting resources and links to some Windows Script
Host (WSH) Web introductions, take a look here:

http://groups.google.co.uk/[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top