Jump to content

Pull service tag from BIOS and use with sysprep to change Computer Nam


Recommended Posts

I use Ghost Cast Server to deploy my images. We use have all Dell systems and would like to pull the service tag # from the BIOS and make that become the Computer Name however we would also like to add either a Image version # to the computer name or add the Image # in the Computer Description.

Can this be done?

Link to comment
Share on other sites


I use Ghost Cast Server to deploy my images. We use have all Dell systems and would like to pull the service tag # from the BIOS and make that become the Computer Name however we would also like to add either a Image version # to the computer name or add the Image # in the Computer Description.

Can this be done?

Here is a vbs script to pull out the bios info, to figure out what you want to use from this.

Option Explicit 
' Set Local Computer
Dim colItems, Computer, objItem, Ts, Z1
Computer = "."
Dim Act :Set Act = CreateObject("WScript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Txt :Txt = Act.SpecialFolders("Desktop") & "\Bios.txt"
Dim Wmi :Set Wmi = GetObject("winmgmts:\\" & Computer & "\root\CIMV2")
Set Ts = Fso.CreateTextFile(Txt)
Set colItems = Wmi.ExecQuery("SELECT * FROM Win32_BIOS",,48)
For Each objItem in colItems

If isNull(objItem.BiosCharacteristics) Then
Ts.WriteLine "BiosCharacteristics" & vbCrlf & Z1
Else
Ts.WriteLine "BiosCharacteristics" & vbCrlf & Join(objItem.BiosCharacteristics, ",")
End If
If isNull(objItem.BIOSVersion) Then
Ts.WriteLine "BIOSVersion" & vbCrlf & Z1
Else
Ts.WriteLine "BIOSVersion" & vbCrlf & Join(objItem.BIOSVersion, ",")
End If
Ts.WriteLine "BuildNumber" & vbCrlf & objItem.BuildNumber
Ts.WriteLine "Caption" & vbCrlf & objItem.Caption
Ts.WriteLine "CodeSet" & vbCrlf & objItem.CodeSet
Ts.WriteLine "CurrentLanguage" & vbCrlf & objItem.CurrentLanguage
Ts.WriteLine "Description" & vbCrlf & objItem.Description
Ts.WriteLine "IdentificationCode" & vbCrlf & objItem.IdentificationCode
Ts.WriteLine "InstallableLanguages" & vbCrlf & objItem.InstallableLanguages
Ts.WriteLine "InstallDate" & vbCrlf & objItem.InstallDate
Ts.WriteLine "LanguageEdition" & vbCrlf & objItem.LanguageEdition
If isNull(objItem.ListOfLanguages) Then
Ts.WriteLine "ListOfLanguages" & vbCrlf & Z1
Else
Ts.WriteLine "ListOfLanguages" & vbCrlf & Join(objItem.ListOfLanguages, ",")
End If
Ts.WriteLine "Manufacturer" & vbCrlf & objItem.Manufacturer
Ts.WriteLine "Name" & vbCrlf & objItem.Name
Ts.WriteLine "OtherTargetOS" & vbCrlf & objItem.OtherTargetOS
Ts.WriteLine "PrimaryBIOS" & vbCrlf & objItem.PrimaryBIOS
Ts.WriteLine "ReleaseDate" & vbCrlf & objItem.ReleaseDate
Ts.WriteLine "SerialNumber" & vbCrlf & objItem.SerialNumber
Ts.WriteLine "SMBIOSBIOSVersion" & vbCrlf & objItem.SMBIOSBIOSVersion
Ts.WriteLine "SMBIOSMajorVersion" & vbCrlf & objItem.SMBIOSMajorVersion
Ts.WriteLine "SMBIOSMinorVersion " & vbCrlf & objItem.SMBIOSMinorVersion
Ts.WriteLine "SMBIOSPresent" & vbCrlf & objItem.SMBIOSPresent
Ts.WriteLine "SoftwareElementID" & vbCrlf & objItem.SoftwareElementID
Ts.WriteLine "SoftwareElementState" & vbCrlf & objItem.SoftwareElementState
Ts.WriteLine "Status" & vbCrlf & objItem.Status
Ts.WriteLine "TargetOperatingSystem" & vbCrlf & objItem.TargetOperatingSystem
Ts.WriteLine "Version" & vbCrlf & objItem.Version
Next
Ts.Close()
Act.Run(Txt),1,True

Link to comment
Share on other sites

The code gives me an error.

Line: 54

Char: 2

Error: The system cannot find the file specified

Code: 80070002

Source (null)

What we would like to do is pull the service tag # and rename the computer to the service tag # then either append it with the image version # or add the image version # to the computer description if possible.

Link to comment
Share on other sites

Change this line in the script, I am using Vista so my desktop path doesnt have spaces in it.

 Act.Run(Txt),1,True

 Act.Run(Chr(34) & Txt & Chr(34)),1,True

Yes what you ask is possible

Example Only If ran like this it will error out

 Dim Key :Key = "HKLM\\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
Dim Act :Set Act = CreateObject("WScript.Shell")
Act.RegWrite Key & chr(34) & "ComputerName" & chr(34) & ", " & Varible From Script

Link to comment
Share on other sites

  • 2 weeks later...

I am researching how to do just what is the subject of this discussion, with one additional step. I would like to append the service tag from the BIOS to our naming convention for the PC's. These are for Public PC's in a library, about 180 of them spread out over 9 branch locaitons. The naming convention is:

LIB-?-ServiceTag

The ? represents a single character the identifies the branch the PC is located in. (A typical name could be LIB-M-98CTY02). I could change the letter in the name as I went from branch to branch. Also, if possible, how would the code highlighted in this subject be integrated with the answer file (sysprep.inf)? Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...