Creating a Script to Automatically Generate Computer Name

MooseMan1

Fully Optimized
Messages
2,627
Location
United States
Hello everyone,

The company I work for uses almost exclusively Dell computers which have service tags as serial numbers. We have been incorporating the service tags into our computer names since I started here in 2011. We have gotten big enough to where I am working on an automated deployment solution so that we don't have to touch every system that we deploy.

What I am hoping to accomplish is to enable the system to automatically create a computer name that includes Dell's Service tag. We use the naming convention COMPUTERTYPE-LOCATION-SERVICETAG (for example, DST-VA-HJ631R1) for a desktop in Virginia with a Dell service tag of HJ631R1. I know that the service tag can be pulled from the BIOS using the command:

wmic bios get serialnumber

However, I have no idea how to take that information and put it into a txt file or something that I could point Sysprep to use for the system name. Could anyone assist in explaining how I could make this happen, preferably with code? :angel:

Thanks in advance, and feel free to ask for more information!
 
I know this thread is a few months old, but just in case you are still around, or anyone else needs it, this will do the trick...
@Echo off
SET SNFile=SN.txt
call :Logit >> %SNFile%
exit /b 0

:Logit
wmic bios get serialnumber
::

Copy exactly as is.
Outputs to SN.txt
 
I know this thread is a few months old, but just in case you are still around, or anyone else needs it, this will do the trick...


Copy exactly as is.
Outputs to SN.txt

Why not just call "wmic bios get serialnumber >> SN.txt"? Same effect, less typing :)
 
Why not just call "wmic bios get serialnumber >> SN.txt"? Same effect, less typing :)
Good point, I should have taken the shorter path. :)
In this case, I have not gone to bed in a while, so I simply copied from a script that I had written a while ago. :whistling:
The other script grabs input from several commands, and is designed to be as simple to modify as just inputting or removing commands.
 
Draygoes,

Many thanks for the reply! I'm glad you didn't overlook it because of its date :) I am working on imaging laptops and need to use their service tags (listed as serial numbers in the BIOS) for the computer names. I am using a product from Symantec (Deployment Solutions) that helps with imaging and may have a different solution, but this may provide a helpful backup/alternative :)
 
Back
Top Bottom