Pre-Install Computer Name Capture Script

Does anyone have a script that would popup a box pre-install to "Assign" the computer to a individual. For example, on a massive deployment you might have a list of computers you need to create with computer names :

Computer Name User Serial Number
VTPHILK Joe Smo XX22XX22

So I would like a pre-install script that would pop a HTA or box and ask what this computers name and user should be. I would input "Joe Smo" and "VTPHILK" and it would image the PC and insert the "Joe Smo" in the USER field of the computer, and auto name it "VTPHILK" and join to the domain? Then grab the serial number and push to the hardware inventory.

Comments

Answers

0

What I do is let the system join my domain with a randomly generated name. Then, I run a post-install script to rename it automatically using the logged in user - we name our machines based on username. You can probably find a script to do it by prompting the user (or you could modify the VBS for the built-in post-install task that does this in the K2000). Or, you could automatically rename the system based on the serial number - if that is your goal.

Although this won't do everything you need it can certainly provide part of a solution for you. Please go through the README included in the .zip for how it works. There are 2 .exes, the one called Getcomputername.exe is a preinstall task. Instead of running it as just getcomputername.exe, run it as getcomputername.exe /dialog
This will popup the dialog you requested during the preinstallation process.
The setcomputername is mid-level task that will apply the computername to a an xp/vista/win7 deployment whether it is a scripted install or an image.

Pre installation task: Vbs script that create a popup asking for PC name, it then copies another script I've created to the T drive (petemp folder) and edit a replacement value for later use. the file is called the MAC address.
Post install task: run "T:\%MAC_address.vbs" this replaces various values like PC name, language etc in the "C:\$WIN_NT$.~BT\winnt.sif" file
Post install task, after WinPE: Last installation task I've created copies a script that is running in "RunOnce" at next boot that ask who the user should be of the PC, this way it is also more flexible, if a user changes or I can have PC's in storage that is installed, but haven't been assigned users :)

I hope this helps =)

I don't mind posting some scripts, but they are acually alot more complext than just that, but if you like I can edit them a bit so they just do that =)

I have removed some of the parts you don't need like setting language settings and other stuff, this only set the PC name and generate a random local admin password (I store that in a sql db, but have taken that part out)

I hope you can use this :)

Pre install script, notis the "Y:\preinstall\15\settings.vbs" part, that need to be changed in order to be the correct script it downloads :)
On Error Resume Next
Set fso = CreateObject("Scripting.FileSystemObject")
Set diskDrives = fso.Drives
Set wshShell = CreateObject("WScript.Shell")
compName="Tralalala"

And last installation step:
I have a group called "Sharedlaptop" that all domain users are in, so all users have admin access to PC's untill it is removed that gives them access to run this scriptstrComputer = "."
dim adminuser, answer
'adminuser = InputBox("Please type the initials of the owner of the PC:" & Chr(10) & "Type SharedLaptop to leave it as a shared laptop", "Who should the PC be assigned to.")

if ucase(platform) = "DESKTOP" Then
Set objGroup = GetObject("WinNT://YourDomain/SharedDesktop")
End if

If ucase(platform) = "LAPTOP" Then
Set objGroup = GetObject("WinNT://YourDomain/SharedLaptop")
End if

If ucase(platform) = "VMWARE" Then
Set objGroup = GetObject("WinNT://YourDomain/SharedDesktop")
end if

'On Error Resume Next

if objAdmins.ismember(objGroup.adspath) then

answer = answer & adminuser & " was already member of to local administrator group" & Chr(10)
end if
if not objAdmins.ismember(objGroup.adspath) then
answer = answer & "SharedLaptop was added to local administrator group" & Chr(10)
if ucase(adminuser) <> ucase("SharedLaptop") then
answer = answer & "Sharedlaptop was removed from local administrator group" & Chr(10)
End if

Ok..i figured it out..I see the PE mounts "net use Y:\\<IP OF RSA>\peinst" and "net use T:\\<IP OF RSA>\petemp". Then your script is using the petemp to store the script info. I was wondering why it was important to use the MAC but now I know :). I'm testing a install now.

I don't know why but I am really having trouble with this. The basic goal I am looking for is as follows:

Prompt for a computer name during pre-install, then run a scripted install. This computer name will typically be the same as the username of the user using it.

Next, postinstall winpe script will fire off use that computer name to replace the unattend.xml computer name with the one from pre-install.

Finally, the postinstall windows script runs which adds the user to the domain local admins user group.

I thought this would not be to hard with the K2200 but it is proving otherwise. The scripted install I have about 4 applications in (Antivirus, Office, 2 VPN clients and firefox) and it is running almost 45 minutes to install. I was hoping to get the speed a little faster since we have over 500 machines to image.

I will post the code for what I am using now as I had to heavily modify the above code for W7 and I think rmeyer removed alot of pieces

Maybe I'm overlooking something- but why not let the computers get delivered to the end user with a randomized name, then have a K1000 script run a rename script against the machine using wsname?
An online script could be configured to run as the logged on user, then the verify stage could look for a key the says if it's already ran, the remediation phase could run a step to run the wsname, then set the key that's detected in the verify step.
The wsname command might look like this: wsname.exe /n:$USERID-$SERIALNUM /rcid /user:mydomain\admin /passm:adminpassword

Just a thought from a different angle- Wsname has some other options for injecting names into sysprep so you could potentially run it as a mid-level postinstall task and have an answer file that contains all your serial numbers or mac addresses and desired new host names. Enable sysprep integration checkbox on your image. I haven't personally tried this, but I'd think it might work rather well.

So that is a thought as well.. However, I have not idea what you are talking about when you say remediation phase etc.. :)

We do also have the K1000. So what you are saying is let each computer have a randomized name during imaging. Then also join them to the domain with that random name during K2000 imaging? Then, have the user login to the PC and at that point the K1000 runs some sort of script to rename the computer on the domain?

Am I following you right?

I'm thinking that this might be a better route. Just do a vanilla image of every machine. Get the computers to the desktops of the user and then have some first time login script which fires off and renames them to the proper name of the computer (We just want to name the computer the persons userid) then joins that username to the admin rights on that PC then reboots.

Yes, this is an autoit script created by myself and Kent Feid. This will get the computer name from the machine and store it on petemp as a mac address file. It can also be used with a /dialog command to pop-up a dialog in case the machine is new. Also can be deployed with /name:computername for one-offs. The setcomputername task works with images AND scripted installs, which is one of the biggest differences between our script and the default script. You can pm me anytime if you would like these scripts. Maybe we can convince higher-ups to give us a space to upload pre/post tasks to share.

3/10/11 - If I sent you the link previously, I updated the script on 3/9/11, so you may want the latest copy at the same link. Hold on to that link and I'll update this page when I update the script. Read the README for details, including a new /timeout:seconds switch if you want.

The Get/Set Computer Name script has been updated to version 1.1.1.2.
Both the get and set scripts limit the name to 15 characters, regardless of what user enters, or what the script gathers from previous name, the computername will never be more than 15 characters.

You can download this and other Scripting Ninja scripts from : http://www.kace.com/support/kb/index.php?action=artikel&cat=5&id=1125&artlang=en