Skip to content

Setting computername during deployment

Featured Replies

how to prompt for Computername during OSD

 

If you want to be prompted for the computername during a deployment (works for the R2 release of SCCM 2007) try the following

 

on your deployment collection, right click and choose modify collection settings

 

create a new variable called OSDComputerName and leave it blank

 

Advertise your task sequence to this collection, but make sure that the Task Sequence is not set to mandatory

 

now, when the Task Sequence executes it will prompt you for the computername during OSD, cool huh ? click on the variable when you see it and enter your desired computername..

 

 

 

Can I script it ?

 

oh and here's another way from the very talented Michael in Denmark smile.gif

 

easy way to change PC name during Deployment

 

and here's a script sample

 

Set env = CreateObject("Microsoft.SMS.TSEnvironment")
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
 env("OSDComputerName") = objItem.SerialNumber
next

 

_________________________

 

Just run this script after the Deploy OS step. It will set the SCCM variable "OSDComputername" to the serial, and the rest will take care of it self...

 

 

Related reading:-

 

here's the Technet version of the same

  • 5 months later...
  • Replies 38
  • Views 215.9k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • how to prompt for Computername during OSD   If you want to be prompted for the computername during a deployment (works for the R2 release of SCCM 2007) try the following   on your deployment colle

  • pranay bhagat
    pranay bhagat

    just as an update...   the script is working fine with MDT 2010...after few changes i figured out that we need to put the script and declare a task sequence variable as OSDCOMPUTERNAME after the fir

  • I don't know if this would be helpful, but I wrote a powershell script that sets the machine name based on the subnet the computer is sitting on during the imaging process. We have distinct sites and

Posted Images

It is exactly what I did this morning and the system ask me the computer name.

But I don't know why it didn't use my computer name I wrote.

 

Any idea?

No I don't.

I have directly Install Operating system.

 

Let me do some tests and I will tell you.

 

Thank you.

  • Author

did you Add a "Set Task Sequence Variable" to the postinstall phase before the "Apply Windows Settings" step ?

 

 

see the following screenshot, however in this screenshot i'm making the computername=the Asset Tag of the computer

 

all you have to do is to leave the assettag value empty

 

osdcomputername.jpg

did you Add a "Set Task Sequence Variable" to the postinstall phase before the "Apply Windows Settings" step ?

 

 

see the following screenshot, however in this screenshot i'm making the computername=the Asset Tag of the computer

 

all you have to do is to leave the assettag value empty

 

post-1-12644489834875_thumb.jpg

 

 

I assume %AssetTag% is being set by Gather?

 

Thanks,

 

Mike

  • Author

Gather gathers info, see below from the Print Ready Documentation, so it will Gather a value for %AssetTag% from the computers bios, next the task sequence above, that value is assigned in the Set Task sequence variable step, and then this is then used by the Configure command (listed below) or during the Setup Windows and ConfigMgr step

 

if you bring up a command prompt (F8) and browse the c:\windows\panther\unattend\unattend.xml file you can see it gets changed during these steps to the values you selected

 

Gather

This task sequence step gathers data and processing rules for the target computer.

 

Configure

This task sequence step configures the Unattend.xml, Sysprep.inf, or Unattend.txt files with the required property values that are applicable to the operating system you are deploying to the target computer. Following is a brief listing of the settings that show how this step was originally configured in one of the MDT 2010 task sequence templates. For more information about which script accomplishes this task and which properties you use, see ZTIConfigure.wsf.

  • 4 weeks later...
  • Author

if you want to rename the computer without using MDT try the suggestion here

 

join a workgroup at the Apply Network Settings step, I have a Run Command Line using the wsname.exe command to change the name after the Setup Windows and ConfigMgr step and then a Join Domain or Workgroup step after that to join it to the domain.
  • 5 months later...

This method probably would be okay if we had SCCM DHCP server which we do not. I am using task sequence created boot disc only to build the computer with a captured image. We are not advertising the task to any collection.

  • 2 months later...

here's a quick TIP

 

If you want to be prompted for the computername during a deployment (works for the R2 release of SCCM 2007) try the following

 

on your deployment collection, right click and choose modify collection settings

 

create a new variable called OSDComputerName and leave it blank

 

Advertise your task sequence to this collection, but make sure that the Task Sequence is not set to mandatory

 

now, when the Task Sequence executes it will prompt you for the computername during OSD, cool huh ?

 

oh and here's another way from the very talented Michael in Denmark :)

 

easy way to change PC name during Deployment

 

and here's a script sample

 

Set env = CreateObject("Microsoft.SMS.TSEnvironment")
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)

For Each objItem in colItems
objItem.SerialNumber=env("OSDComputername")

Next

 

_________________________

 

Just run this script after the Deploy OS step. It will set the SCCM variable "OSDComputername" to the serial, and the rest will take care of it self...

 

 

Great post, this has been helpful!!

 

I want to find out if anyone has had any success with creating a custom Task Sequence that renames a computer??

 

For instance, I'm working on a TS that will prompt for a new name, unjoin the machine from the domain to a workgroup, then rejoin with a new name.

 

Thus far I am able to prompt for and obtain the new name either when the TS is launched from PXE by using a TS Variable, or when launched from the Run Advertised Programs control panel applet by using a script to prompt for the name.

 

The point I am at a stall at is when it comes to applying the new name. From what I know the only time the variable for OSDComputerName is paid attention to is during the "Applying Windows Settings" task. However, since this isn't a full OSD TS there seems to be an issue with using this step in my custom TS. There is a Task Sequence error that references this, it's small but I won't paste it in this entry however, I will attach the error to this posting as a text file if anyone is curious.

 

 

This thread has been active on and off so I hope there are still members out there paying attention who might have some ideas on how to get around this or on another method to use. Thanks in advance!

 

 

UPDATE:

My Apologies, everyone. I thought I scanned through this entire article but it appears I did not!

There is a posting by AnyWeb on Feb 23rd that provides an option to perform just what I'm trying to do by using a third party name changing tool.

 

These forums are extremely helpful. Thanks again!

TaskSequenceError.txt

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.