Easy Way to Prompt Computer name during SCCM OSD

You can configure the client to prompt computer name during SCCM OSD without using any scripts. You can set the computer name prompt during OSD using SCCM task sequence.

One of the most common requirements during the OS deployment process in SCCM is specifying the computer name. Nobody wants a random computer name assigned to the laptop and expect IT to rename it after imaging.

I know there are several ways to prompt computer name during SCCM OSD. You can either use a PowerShell script or use OSD computer name script.

If you are using MDT, you get more options to customize and overall it offers more advantages that a normal task sequence. Not everyone uses MDT in their setup.

However, without using any scripts, we can configure our task sequence to prompt computer name during SCCM OSD. If you are already using a PowerShell script to achieve this task, this method is actually simpler.

When you deploy a task sequence, the client computer gets a random name after the imaging is complete. Usually, the computer name begins with MININT- and the rest of the name is randomly chosen.

Using the OSDCOMPUTERNAME variable, we will configure the SCCM task sequence and allow the client to prompt computer name during SCCM OSD. When you make the changes and deploy the task sequence, you have to enter the computer name.

Define OSDCOMPUTERNAME Variable

First, we need to define the OSDCOMPUTERNAME variable before using it. The SCCM task sequence comes with built-in variables, and OSDCOMPUTERNAME is one among them.

When the task sequence executes the OSDCOMPUTERNAME variable step, it prompts to enter the computer name. The entered name will be the computer name after the imaging is complete.

You can refer the following Microsoft article for all the Task sequence variables. The computer name variable is actually stored in a task sequence variable called OSDCOMPUTERNAME.

So we define the OSDCOMPUTERNAME variable on a device collection to which the task sequence is deployed. For example, in my case I have a task sequence that is currently deployed to All Unknown computers device collection.

If you have got any other device collection, you must perform the same steps for that collection.

Right click the All Unknown computers device collection and click Properties. Click the Collection Variables tab. Click the Yellow Star icon to define a new variable.

Set OSDCOMPUTERNAME Variable
Set OSDCOMPUTERNAME Variable

On the new variable window, define the variable. Specify the name as OSDCOMPUTERNAME. Ensure Do not display this value in the Configuration Manager console is checked. Do not specify anything for Value and Confirm, just leave it blank. Click OK.

Define OSDCOMPUTERNAME Variable
Define OSDCOMPUTERNAME Variable

Once you are done making the changes, click OK and close the properties window.

Prompt Computer name during SCCM OSD
Prompt Computer name during SCCM OSD

Prompt Computer name during SCCM OSD

We will now test if we can successfully prompt computer name during OSD via SCCM task sequence. We will PXE boot a VM and see if we get the computer name prompt during OSD.

The SCCM task sequence wizard should display the computer name prompt with OSDCOMPUTERNAME variable. To specify the computer name, you must first click the Edit button.

In the Value box, enter the computer name and click OK.

Prompt Computer name during SCCM OSD
Prompt Computer name during SCCM OSD

The next screen confirms the computer name that you just entered. If you wish to change the computer name, click Edit and enter it again. Otherwise click Next.

Note – Windows doesn’t permit computer names that exceed 15 characters. So enter the computer name correctly here. If you enter more than 15 characters, the task sequence will fail with error code 0x80220005.

Prompt Computer name during SCCM OSD
Prompt Computer name during SCCM OSD

Finally, when the imaging is complete, we see the computer name matches the one that we had defined. Congratulations, you just learned how to set computer name during SCCM OSD without using any script.

OSDCOMPUTERNAME Variable
OSDCOMPUTERNAME Variable

24 Comments

  1. Please tell me if it is possible to somehow automate the process of creating a PC name with OSD. For example, what would it be like LT (the first part is not changed), and the second part is the inventory number or serial number that is recorded in the BIOS (each time is different)

  2. Seconding Andrew’s question. Any chance of requiring that OSDComputerName have a new value entered before launching the Task Sequence? I’ve got a few too many people who forget this step. The number of MININT machines is getting a little out of hand.

    Your site and guides are amazing, btw.

  3. Avatar photo Joseph Weatherton says:

    Hello, Thanks so much for all of your solutions. I am using SCCM current branch 2111. these steps work perfect for a bare metal computer, however I cant seem to get the name to change on an in-place upgrade (IE the machine already has an SCCM computer object). I have set the “osdcomputername “variable to blank as described on the “All Unknown Computers” and “All Desktop and Server Clients” collections. I have also tried setting “OSDMigrateComputerName” to “false” for those collections, but it always migrates the name associated with the existing sccm computer object. Any suggestions on how to never keep the old name, we just want to input a name during every task sequence.

    1. This is exactly what we are trying to do… I do not know if this is a PXE only command or not. Did you find a way around this?

  4. This step worked for us but now it seems it won’t join the PC to the domain. Any thoughts?

    1. Check the domain join step in the TS and also review the smsts.log to see if there are any errors.

    2. Avatar photo xuanyuanjian says:

      The computer already exists in the sccm device collection,remove computer and check。

  5. Is there a way that you can make the variable required? For example, a user can not click “Next” until they enter something into the Value box on the edit variable screen.

  6. Is there a way to prompt with imaging using USB?
    We have it working with Networked PXE but wondering if we can with USB drives.

    1. I am uncertain if it works with USB drives, honestly, I haven’t tested it with USB devices.

  7. Avatar photo Chimmu Jhulewala says:

    Great, Brother.
    You are amazing.

  8. I do not want to add this variable to a device collection. Can I just add this to the task sequence itself?

  9. Avatar photo John Jones says:

    Love your page – There is now an ad every few sentences. Hopefully this is in error and not a new look. Thanks for all the great content.

    1. Thank you John. About the ads, I know they appear randomly and I have no control over it as Google decides to place the ads. Is it too annoying while reading ?. Let me know.

  10. Hi,

    While formatting hp elitebook 840 G7 laptop with external Lancard and its getting formatted.But when iam formatting another new laptop of same model with the same external lancard its not asking for hostname and its taking the same hostname of the previous laptop. With this iam facing the issue of trust relationship. Please can you help on this

      1. I am having the same issue where it is not prompting but grabbing the name of the last imaged laptop. This causes big problems with trust relationships. None of them are prompting for OSD. Was there ever a fix here? Is there a way to force OSDCOMPUTERNAME to run even if the computer was previously on the network?

  11. Thank you for the excellent documentation. Is there a way to automate the creation of the OSDComputerName variable to make the computer name DT-%SerialNumber%, or LT-%SerialNumber%, or VM-%SerialNumber based on the system that is imaging?

  12. Avatar photo Deter cache says:

    My question is there a way to have PowerShell prompt the user to change the PC name? I found methods that use SetupUI.exe but none of the scripts changed the hostname.

  13. Nice article, I think Romain wanted to say that the defualt name for any workstation would be MININT-XXXXX if left blank in the field OSDCOMPUTER NAME. Perhaps he also wanted to point out that the task sequence would continue if you skip (do not enter any vaule in the filed). Is the a way to force entering the computer name vaule and by doing so the task sequence cant continue? BTW I’ve been a huge fan of your work! Keep it up! Cheers from ground shaking Croatia!

  14. Nice,
    But it doesn’t avoid the risk of an already existing computername.

      1. He means that if u take a name who already exist in your domain, it will take his place and the old computer wont be able to log on the domain anymore

        1. Avatar photo KristapsZ says:

          No
          I am using this for years. if computer is in sccm database (presumably all of your domain computers are) window to set OSDCOMPUTERNAME will be not displayed.
          And if you want to reinstall computer with new name before deploying delete it from the DB

Leave a Reply

Your email address will not be published. Required fields are marked *