MSFN Forum: Pull service tag from BIOS and use with sysprep to change Computer Nam - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Pull service tag from BIOS and use with sysprep to change Computer Nam Computer Name Rate Topic: -----

#1 User is offline   TeqGirl 

  • Group: Members
  • Posts: 2
  • Joined: 06-March 08

Posted 06 March 2008 - 01:24 PM

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?


#2 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,019
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 06 March 2008 - 01:50 PM

View PostTeqGirl, on Mar 6 2008, 09:24 PM, said:

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.

Quote

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


#3 User is offline   TeqGirl 

  • Group: Members
  • Posts: 2
  • Joined: 06-March 08

Posted 06 March 2008 - 02:46 PM

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.

#4 User is offline   gunsmokingman 

  • MSFN Master
  • Group: Super Moderator
  • Posts: 2,019
  • Joined: 02-August 03
  • OS:none specified
  • Country: Country Flag

Posted 06 March 2008 - 03:15 PM

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

Quote

 Act.Run(Txt),1,True


Quote

 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

Quote

 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


#5 User is offline   snovertj 

  • Group: Members
  • Posts: 1
  • Joined: 19-March 08

Posted 19 March 2008 - 11:23 PM

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.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy