Solved

Query Serial, Model, Express numbers on a Dell computers

Posted on 2009-04-06
12
708 Views
Last Modified: 2013-12-25
I am building an inventory management system and need to query serial, model, express codes on all the Dell Desktop and Laptops we have in inventory. The code I posted will give me the serial number, but I'm not sure to grab the Model and Express code.

'
on error resume next
strComputer=InputBox ("Enter the computer name of the server you'd like to query for 
 
Service Tag")
Set objWMIservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48)
For each objitem in colitems
      Wscript.echo "Dell Service Tag: " & objitem.serialnumber
Next
'

Open in new window

serial-number-txt.txt
0
Comment
Question by:UDDevHelp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
12 Comments
 
LVL 10

Expert Comment

by:borgunit
ID: 24080004
0
 
LVL 14

Accepted Solution

by:
yehudaha earned 500 total points
ID: 24083851
try this

the express function from post in techrepublic
strComputer = InputBox ("Enter the computer name of the server you'd like to query for Service Tag")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
strSerial = objItem.SerialNumber
Next
 
 
 
WScript.Echo "Your Serial: " & strSerial
Wscript.Echo "Express code: " & Base2Base(strSerial, 36, 10)
WScript.Echo "Model :" & model(strComputer)
 
Function model(strComputer)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) 
For Each objItem in colItems
model = objItem.Model 
next
End Function
 
Function Base2Base(InputNumber,InputBase,OutputBase)
Dim J, K, DecimalValue, X, MaxBase, InputNumberLength
Dim NumericBaseData, OutputValue
NumericBaseData = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MaxBase = Len(NumericBaseData)
if (InputBase > MaxBase) OR (OutputBase > MaxBase) then
Base2Base = "N/A"
Exit Function
end if
'Convert InputNumber to Base 10
InputNumberLength = Len(InputNumber)
DecimalValue = 0
for J = 1 to InputNumberLength
for K = 1 to InputBase
if mid(InputNumber, J, 1) = mid(NumericBaseData, K, 1) then
DecimalValue = DecimalValue+int((K-1)*(InputBase^(InputNumberLength-J))+.5)
end if
next
next
'Convert the Base 10 value (DecimalValue) to the desired output base
OutputValue = ""
while DecimalValue > 0
X = int(((DecimalValue/OutputBase)-int(DecimalValue/OutputBase))*OutputBase+1.5)
OutputValue = mid(NumericBaseData, X, 1)+OutputValue
DecimalValue = int(DecimalValue/OutputBase)
Wend
Base2Base = OutputValue
Exit Function
End Function

Open in new window

0
 

Author Comment

by:UDDevHelp
ID: 24188730
this script doesnt run...
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 14

Expert Comment

by:yehudaha
ID: 24190876
you saved it as a vbs file ?

error message popup ?
0
 

Author Comment

by:UDDevHelp
ID: 24193986
Works!! I saved as .vbs before, maybe I messed up somewhere! Thank you so much!
0
 

Author Closing Comment

by:UDDevHelp
ID: 31567030
This is a life and time saver! Thank you so much!
0
 
LVL 14

Expert Comment

by:yehudaha
ID: 24194025
no problem
thanks for the grade
0
 

Author Comment

by:UDDevHelp
ID: 24194545
We further expanded upon this script so users can just run it without having to know their Hostname. Also, it prompts users to enter in their email address, so the results will get emailed directly to the person collecting Inventory!

Try it out!

Make sure you change the Email server SMTP settings and the "to" email address.
'strComputer = InputBox ("Enter your hostname")
 
	Dim WSHShell
	Dim objNTInfo
	Dim GetComputerName
 
	Set objNTInfo = CreateObject("WinNTSystemInfo")
	strComputer = lcase(objNTInfo.ComputerName)
 
strMyEmailAddr = InputBox("Please enter in your email address")
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
strSerial = objItem.SerialNumber
Next
 
 
 
'WScript.Echo "Your Serial: " & strSerial
'Wscript.Echo "Express code: " & Base2Base(strSerial, 36, 10)
'WScript.Echo "Model :" & model(strComputer)
MsgBox("Thank You!")
 
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Inventory Info"
objMessage.From = strMyEmailAddr
objMessage.To = "email@yourdomain.com"
objMessage.TextBody = "Your Serial: " & strSerial & vbCrLf & "Express code: " & Base2Base(strSerial, 36, 10) &  vbCrLf & "Model :" & model(strComputer)
 
 
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
 
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
 
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourEmailServer.com"
 
'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
 
objMessage.Configuration.Fields.Update
 
'==End remote SMTP server configuration section==
 
objMessage.Send
 
 
Function model(strComputer)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48) 
For Each objItem in colItems
model = objItem.Model 
next
End Function
 
Function Base2Base(InputNumber,InputBase,OutputBase)
Dim J, K, DecimalValue, X, MaxBase, InputNumberLength
Dim NumericBaseData, OutputValue
NumericBaseData = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MaxBase = Len(NumericBaseData)
if (InputBase > MaxBase) OR (OutputBase > MaxBase) then
Base2Base = "N/A"
Exit Function
end if
'Convert InputNumber to Base 10
InputNumberLength = Len(InputNumber)
DecimalValue = 0
for J = 1 to InputNumberLength
for K = 1 to InputBase
if mid(InputNumber, J, 1) = mid(NumericBaseData, K, 1) then
DecimalValue = DecimalValue+int((K-1)*(InputBase^(InputNumberLength-J))+.5)
end if
next
next
'Convert the Base 10 value (DecimalValue) to the desired output base
OutputValue = ""
while DecimalValue > 0
X = int(((DecimalValue/OutputBase)-int(DecimalValue/OutputBase))*OutputBase+1.5)
OutputValue = mid(NumericBaseData, X, 1)+OutputValue
DecimalValue = int(DecimalValue/OutputBase)
Wend
Base2Base = OutputValue
Exit Function
End Function

Open in new window

0
 
LVL 14

Expert Comment

by:yehudaha
ID: 24194575
thanks for sharing
0
 

Author Comment

by:UDDevHelp
ID: 24194593
Not a problem, that's what it's all about!
0
 

Author Comment

by:UDDevHelp
ID: 24280294
Anyone have any idea how to get the IP address of the person running this script?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ESXi 5.5.0, 1623387 - HP Proliant DL380P G8 server 6 69
Nifty tent 7 87
Screen Resolution samsung monitor 7 68
Problem with sound with Bose headset 4 67
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Arrow Electronics was searching for a KVM  (Keyboard/Video/Mouse) switch that could display on one single monitor the current status of all units being tested on the rack.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question