Sep 06

Rename computername during SCCM Tasksequence

Rename computername during SCCM Tasksequence

At one of my customers I was responsible for deploying computers using SCCM 2007 R2.
The customer asked me to add computers to SCCM using a continuous number, but during the deployment the computers must be renamed to identify if it’s a laptop or a desktop.
e.g. for a laptop: LT000001

To fix this issue and rename the computers I created a VBScript, called Computername.vbs

First I’ve set the variables for the script, where I use the TaskSequence variable to receive the computername from the SCCM-database.

Then I added an option to set the continuous number if the deployment was executed by Task Sequence Media (e.g. USB-stick).

The customer used Fujitsu hardware and for laptops they only used “Lifebook”-computers. So I used the following check to identify if the hardware was a laptop or a desktop.

Now the renaming can begin, this is the easy part. 🙂

Of course you can add more conditions to the script, but the most important part of the renaming is when and how you run the script.
To run the script I added a Command Line-job where I selected the package-name and in the Command Line-box I added the name of the script:


Then I made sure this script runs BEFORE you apply the Operating System:
That’s it! With these settings you can rename your computer during deployment.
I hope this article will help you in your SCCM environment! If you have any additional comment, please let me know!


Skip to comment form

  1. Mike

    From this script the user will be prompted to enter the computer name?
    IS there a way to script to step?

    1. Ruben Koene

      Hi Mike,

      The script uses the computername you’ve entered in SCCM, BUT if you use a “Task Sequence Media”, like a prepared USB stick, then the computername will start with “MiniNt”. In my script the computername is checked and when it starts with “MiniNt”, then you will get a prompt to enter the computername. I use it, because the only reason a “Task Sequence Media” is used in my current environment is when a admin or engineer is working with the computer. Real users will never use a “Task Sequence Media” in my current environment.

      I hope this answers your question.

      Kind Regards,
      Ruben Koene

  2. Kevin Brown

    This is just what I am looking for but I am having issues with it, I keep getting a scrip error at “line 1 charecter 27”

    Can you help?
    Kind Regards

    1. Ruben Koene

      Hi Kevin,

      I guess you copied it including layout. Replace all the with default notepad . That will do the trick.

      regards, Ruben

Leave a Reply