Windows 7 Sysprep getting serialnumber from bios

Hi,

I have a sysprep image that prompts for a computerName, changes the machine name and joins it to the domain, all working well.

However, I would like to grab the machine serial number to set as the computerName.  I have found many possibilities from WMI and some VBS scripting which work when I run them on a fully installed machine.  However, If I try to use it in a vbs script that runs before joining the domain (specialize stage), the machine reboots during the setup and never completes its sysprep, essentially corrupting the machine.

I am starting to believe that wmi is not totally available during the specialize stage.  Just curious, any other methods that people have been successful with?
LVL 4
Anthony CarterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Walter CurtisSharePoint AEDCommented:
In the XP days, I used WinPE which supported VBS and WMI. Grabbed the serial number using WMI that read bios, connected to an excel file on a network share (using VBS) to determine the corresponding computer name, then wrote to the computer name in to ini file in the sysprep folder that held info needed to rename the machine and join it to the domain.

Surely something is similar with Win7.

Hope that helps...
0
ivan rosaCommented:
I know in a batch to get a SN there's this command
    wmic bios get serialnumber

And this for .vbs   --see https://support.microsoft.com/en-us/kb/558124 

On Error Resume Next
Dim strComputer
strComputer = InputBox("Enter the name of the computer:")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
MsgBox strComputer & ": " & objSMBIOS.SerialNumber
Next
0
Anthony CarterAuthor Commented:
Ivan:  Yes, I have tried both of those methods and it causes sysprep to crash in the specialize phase.
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

arnoldCommented:
why not set the name/domain join as a bootup script after the sysprep.
ON first boot it will run the system customization/naming .........
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony CarterAuthor Commented:
Hi Arnold,

Yes, I could do this and this is probably the way I am going to go.  Activation against our kms server will also need to be deferred and I was hoping that this could just be done purely in sysprep.  Just throwing out there if anyone had a solution to this or not within sysprep.
0
ivan rosaCommented:
Here's  crazy thought what about create a separate script before syspep to deliver a the sn in a txt then in syspep link it to it
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.