Sponsored Links

Login Form






Lost Password?

Syndicate

Home
Query Dell Service Tag: Revised PDF Print E-mail
User Rating: / 5
PoorBest 
Written by Cheyenne Harden   
This is an update to the previous script "Query Dell Service Tag".
I couldn't leave well enough alone...
The LazyNetworkAdmin defined his script as,
"Because most of the computers I work on are Dell's,
a lot of times I need to look up the service tag for a specific machine.
Without the need of bulky software, you can easily use WMI to gather this information.
This article will show you how to remotely query your dell pc's for their service tags."

----------COPY EVERYTHING BELOW THIS LINE----------

On Error Resume Next
Const ForWriting = 8

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
strDomain = "YOUR_DOMAIN_HERE" ' Your Domain (e.g., monster.com)
strPCsFile = "Service_Tag.txt"
strPath = "C:\scripts\" ' Create this folder
strWorkstationID = "C:\scripts\Service_Tag.txt"
i = 0

'#########
Set objFSO3 = CreateObject("Scripting.FileSystemObject")

If objFSO3.FileExists(strPath & strPCsFile) Then
 Set objFolder = objFSO3.GetFile(strPath & strPCsFile)

Else
  Set objFSOf = CreateObject("Scripting.FileSystemObject")
  If objFSOf.FolderExists(strPath) Then
   Set objFolder = objFSOf.GetFolder(strPath)
  Else
   Set objFolder = objFSO3.CreateFolder(strPath)
  End If
 Set objFile1 = objFSO3.CreateTextFile(strPath & strPCsFile)
 objFile1.Close

End If
'#########

Wscript.Echo "This program will return the Dell Service Tag on remote computer(s)"
strMbox = MsgBox("Would you like info for the entire domain: Matrixsvr ?",4,"Hostname")

If strMbox = 6 Then
'Set objPCTXTFile = objFSO.OpenTextFile(strPath & strPCsFile, ForWriting, True)
Set objDomain = GetObject("WinNT://" & strDomain) ' Note LDAP does not work
objDomain.Filter = Array("Computer")
For Each pcObject In objDomain 
objDictionary.Add i, pcObject.Name
'Wscript.Echo objDictionary(i)
i = i + 1

Next

For each DomainPC in objDictionary
strComputer = objDictionary.Item(DomainPC)
GetWorkstationID()
Next

Set objFilesystem = Nothing

WScript.echo "Finished Scanning Network check : " & strPath

Else
strHost = InputBox("Enter the computer you wish to find the Dell Service Tag from","Hostname"," ")
GetWorkstationID2()
End If

Sub GetWorkstationID()

On Error Resume Next

Set objWMIservice = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48)
For each objitem in colitems
 
      strWriteFile = strComputer &"   Dell Service Tag: " & objitem.serialnumber

Next
'#############

Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.OpenTextFile(strPath & strPCsFile, ForWriting, True)
objOutputFile.WriteLine(strWriteFile)
objOutputFile.Close

'#############
End Sub

Sub GetWorkstationID2()

On Error Resume Next
Wscript.echo strComputer & ": " & objitem.serialnumber
Set objWMIservice = GetObject("winmgmts:\\" & strHost & "\root\cimv2")
set colitems = objWMIservice.ExecQuery("Select * from Win32_BIOS",,48)
For each objitem in colitems

      Wscript.echo "Computer: " & strHost & "   Dell Service Tag: " & objitem.serialnumber
   strWriteFile = "Computer: " & strHost &"   Dell Service Tag: " & objitem.serialnumber

   Next
'%%%%%%%%%%

Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.OpenTextFile(strPath & strPCsFile, ForWriting, True)
objOutputFile.WriteLine(strWriteFile)
objOutputFile.Close

'%%%%%%%%%%
End Sub


----------COPY EVERYTHING ABOVE THIS LINE----------

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need two things!


1. You will need to have Admin privlidges on the target computers.
2. You will need the name of your domain (e.g., strDomain = "YOUR_DOMAIN_HERE" ' Your Domain (e.g., monster.com))

This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
handcrafted jewellry - handcrafted jewellry     | 222.131.25.xxx | 20-11-2008 05:42:14
wholesale jewelry
handmade jewelry
handcrafted jewelry
jewelry wholesale
wholesale handmade jewelry
pearl jewelry
wholesale pearl jewelry
wholesale turquoise jewelry
wholesale coral jewelry
wholesale shell jewelry
wholesale gemstone jewelry
wholesale crystal jewelry
fashion jewelry
wholesale jewellry
[url=h...
fashion jewelry - jewelry wholesale     | 222.131.25.xxx | 20-11-2008 05:43:07
wholesale jewelry
jewelry store
fashion jewelry
crystal jewelry
jewelry wholesale
pearl jewelry
wholesale crystal
wholesale pearl
wholesale turquoise
wholesale semi-precious jewelry
wholesale coral
wholesale shell
wholesale swarovski crystal
caz   | 212.85.1.xxx | 26-11-2008 10:20:17
Runs, then closes...nothing..
caz   | 212.85.1.xxx | 26-11-2008 10:33:13
Does work, my mistake. a quick note to say save as .vbs is helpful if your new to site however.
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google