Jump to content




anyweb

How can I easily prompt for a computer name in Configuration Manager 2012



Recommended Posts

When you install new computers it would be nice to be able to easily name the computer as part of the deployment, otherwise the new computer could end up with a name like MININT-XRGHJTF unless you import it into Configuration Manager first. You can script around this in your task sequence or use web services or HTA's but the easiest method of all is to set a Collection variable called OSDComputerName. This method does not require any scripting all you need to do is to Enable Unknown Computer support in the Distribution Point PXE tab settings.

 

enable unknown computer support.png

 

To prompt the end user to enter a computer name In Configuration Manager 2012 by using the OSDComputerName variable you first need to think about the computers you are aiming this at, and in this case the computers are unknown computers, that is, they are unknown to Configuration Manager.

 

Step 1. add the collection variable

 

Now that we know that they are unknown we need to select the Unknown Computers collection called All Unknown Computers. Right click and choose Properties.

 

all unknown computers properties.png

 

select the Collection Variables tab and click on the Yellow star burst button as shown below

 

collection variables.png

 

enter the following variable name when prompted OSDComputerName, remove the checkmark from Do Not Display this value in the Configuration Manager console as in the screenshot below

 

new variable.png

 

click ok and apply so that it looks like this

 

OSDComputerName.png

 

Step 2. Make sure you have Deployed a task sequence to the Unknown Computers collection

 

Verify that you have deployed your chosen task sequence to the Unknown Computers collection by selecting the task sequence and clicking on the Deployments tab. The deployments listed should include one for the All Unknown Computers collection as shown below. If not, then create a new deployment for the task sequence and choose the All Unknown Computers collection for that deployment.

 

deployed to all unknown computers.png

 

 

Step 3. PXE boot a new computer

 

PXE boot a new computer. Press F12 when prompted

 

Note: make sure the computer is NOT present in Configuration Manager prior to this, either as a previous computername or as an UNKNOWN object, if it is, highlight it in All Systems and delete it.

 

computer pxe booting.png

 

select your task sequence and click next

 

select task sequence.png

 

now you will see a Task Sequence window called Edit Task Sequence Variables

 

edit task sequence variables.png

 

double click on OSDComputerName, the following should appear

 

OSDComputerName double click.png

 

type in a computername

 

computername entered.png

 

click ok and the computername value should be listed to the right of the variable name as shown below

 

value listed.png

 

click next and the task sequence completes as normal

 

Step 4. Verify that it worked

 

Now that the Task Sequence is complete you can logon to your computer, bring up the computer properties and note the computername is what you entered earlier.

 

computername.png

 

the variable is set during the Apply Windows settings step of the task sequence and you can see the collection variable being added in the SMSTS.log file (found in C:\Windows\CCM\Logs)

 

adding collection variable.png

 

that's it, I told you it was easy !

 

cheers

niall

  • Like 3

Share this post


Link to post
Share on other sites


experiencing the same issue as moustafafafa and I find it utterly annoying...

I was thinking something went wrong with my sccm install but apparently not. I'm going to google around a bit to check what can be done.

Share this post


Link to post
Share on other sites

Hey guys, I do it a slightly different way, mainly because we like to use the asset number from our DELL computers as the computer name account.

 

Here's the link.

Share this post


Link to post
Share on other sites

Hi Guys...Dani3l

 

I never new you could do variables to add a computer name (cool)......but this is what I use in SCCM 2012 and it works just as it should (Dani3l this works for me)....you can leave it attached to your TS at all times and during OSD time when SCCM database knows the computer name it will bypass this step and it will hold on to it's old name, if it does not know the computer name(out of the box or Unknown) it will prompt you to enter one in....pretty cool..

 

Dim sNewComputerName, oTaskSequence, sTSMachineName, bPromptName

Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")

' Get the name the computer is set to receive and truncate to first 6 letters

sTSMachineName = lcase(oTaskSequence("_SMSTSMachineName"))

If left(sTSMachineName,6) = "minint" Then

bPromptName = True

ElseIf sTSMachineName = "minwinpc" Then

bPromptName = True

Else

bPromptName = False

End If

' Note: The wscript.echo commands are logged in SMSTS.log for troubleshooting. They are not displayed to the end user.

If bPromptName = True Then

wscript.echo "Detected that the computer name is scheduled to receive a random value. Prompting user to input a standard name."

sNewComputerName = InputBox ("Please enter a standard computer name to continue.", "Computer Name", , 30,30)

oTaskSequence("OSDComputerName") = UCase(sNewComputerName)

wscript.echo "Set Task Sequence variable OSDComputerName to: " & sNewComputerName

Else

wscript.echo "Computer set to receive a standard name, continuing as is."

End If

 

 

 

 

 

Rocket Man

Share this post


Link to post
Share on other sites

experiencing the same issue as moustafafafa and I find it utterly annoying...

I was thinking something went wrong with my sccm install but apparently not. I'm going to google around a bit to check what can be done.

 

This is a byproduct of leveraging unknown computer support. During the TS process, SCCM has to create an object for any "Unknown" computers so that the SCCM database can "recognize" it and thus service it in the TS. If during the TS, the TS fails, SCCM does not remove the "orphaned' Unknown computer object. It has to be manually deleted.

 

http://blogs.technet.com/b/inside_osd/archive/2012/05/02/managing-unprovisioned-computers-in-system-center-2012-configuration-manager.aspx

Share this post


Link to post
Share on other sites

Hello:

 

I was trying to accomplish this by right clicking on the 'All Unknown Computers' collection, but the properties for this collection are all greyed out and won't let me make any modification. Please help! Thanks!

Share this post


Link to post
Share on other sites

Does not work in beta!!

 

It should be sorted in RTM SP1....

 

For now you could use the script that I posted previous...this does work in all versions!

Share this post


Link to post
Share on other sites

I am using SCCM 2012. My OSDComputerName does not function. It did at one time. Everymachine I deploy just gets the name of the reference computer. It looks like it might be using a unattend.xml file from the image. Does anyone have a thought as to why it is doing this? I cannot have it prompted for a name as the value is being supplied. Any thoughts would be appreciated.

Share this post


Link to post
Share on other sites

When you install new computers it would be nice to be able to easily name the computer as part of the deployment, otherwise the new computer could end up with a name like MININT-XRGHJTF unless you import it into Configuration Manager first. You can script around this in your task sequence or use web services or HTA's but the easiest method of all is to set a Collection variable called OSDComputerName. This method does not require any scripting all you need to do is to Enable Unknown Computer support in the Distribution Point PXE tab settings.

 

attachicon.gifenable unknown computer support.png

 

To prompt the end user to enter a computer name In Configuration Manager 2012 by using the OSDComputerName variable you first need to think about the computers you are aiming this at, and in this case the computers are unknown computers, that is, they are unknown to Configuration Manager.

 

Step 1. add the collection variable

 

Now that we know that they are unknown we need to select the Unknown Computers collection called All Unknown Computers. Right click and choose Properties.

 

attachicon.gifall unknown computers properties.png

 

select the Collection Variables tab and click on the Yellow star burst button as shown below

 

attachicon.gifcollection variables.png

 

enter the following variable name when prompted OSDComputerName, remove the checkmark from Do Not Display this value in the Configuration Manager console as in the screenshot below

 

attachicon.gifnew variable.png

 

click ok and apply so that it looks like this

 

attachicon.gifOSDComputerName.png

 

Step 2. Make sure you have Deployed a task sequence to the Unknown Computers collection

 

Verify that you have deployed your chosen task sequence to the Unknown Computers collection by selecting the task sequence and clicking on the Deployments tab. The deployments listed should include one for the All Unknown Computers collection as shown below. If not, then create a new deployment for the task sequence and choose the All Unknown Computers collection for that deployment.

 

attachicon.gifdeployed to all unknown computers.png

 

 

Step 3. PXE boot a new computer

 

PXE boot a new computer. Press F12 when prompted

 

Note: make sure the computer is NOT present in Configuration Manager prior to this, either as a previous computername or as an UNKNOWN object, if it is, highlight it in All Systems and delete it.

 

attachicon.gifcomputer pxe booting.png

 

select your task sequence and click next

 

attachicon.gifselect task sequence.png

 

now you will see a Task Sequence window called Edit Task Sequence Variables

 

attachicon.gifedit task sequence variables.png

 

double click on OSDComputerName, the following should appear

 

attachicon.gifOSDComputerName double click.png

 

type in a computername

 

attachicon.gifcomputername entered.png

 

click ok and the computername value should be listed to the right of the variable name as shown below

 

attachicon.gifvalue listed.png

 

click next and the task sequence completes as normal

 

Step 4. Verify that it worked

 

Now that the Task Sequence is complete you can logon to your computer, bring up the computer properties and note the computername is what you entered earlier.

 

attachicon.gifcomputername.png

 

the variable is set during the Apply Windows settings step of the task sequence and you can see the collection variable being added in the SMSTS.log file (found in C:\Windows\CCM\Logs)

 

attachicon.gifadding collection variable.png

 

that's it, I told you it was easy !

 

cheers

niall

 

 

I can confirm that the above method for prompting for a computer name works with unknown computers - my question now is: How do I get it to work with known computers that are already in a collection?

 

Every time I try to PXE boot an already known computer, I get to the point of where it will prompt me for a computer name - but then it fails immediately afterwards

 

OP please help!!

Share this post


Link to post
Share on other sites

Why would you want to change the name of already known computers that has been named previously via this method?

 

This variable I feel is only suited to the unknown computers collection.......As you mentioned if you want to refresh an already known machine either by Staging the OS or via PXE then there should be no need to have to enter in a name again!!

SCCM is intelligent enough to hold onto it's old name!!

 

If you want this to work just delete one machine name from SCCM console.....PXE boot the deleted machine and this time it should work as it is unknown again.

Share this post


Link to post
Share on other sites

Hi Guys...Dani3l

 

I never new you could do variables to add a computer name (cool)......but this is what I use in SCCM 2012 and it works just as it should (Dani3l this works for me)....you can leave it attached to your TS at all times and during OSD time when SCCM database knows the computer name it will bypass this step and it will hold on to it's old name, if it does not know the computer name(out of the box or Unknown) it will prompt you to enter one in....pretty cool..

 

Dim sNewComputerName, oTaskSequence, sTSMachineName, bPromptName

Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")

' Get the name the computer is set to receive and truncate to first 6 letters

sTSMachineName = lcase(oTaskSequence("_SMSTSMachineName"))

If left(sTSMachineName,6) = "minint" Then

bPromptName = True

ElseIf sTSMachineName = "minwinpc" Then

bPromptName = True

Else

bPromptName = False

End If

' Note: The wscript.echo commands are logged in SMSTS.log for troubleshooting. They are not displayed to the end user.

If bPromptName = True Then

wscript.echo "Detected that the computer name is scheduled to receive a random value. Prompting user to input a standard name."

sNewComputerName = InputBox ("Please enter a standard computer name to continue.", "Computer Name", , 30,30)

oTaskSequence("OSDComputerName") = UCase(sNewComputerName)

wscript.echo "Set Task Sequence variable OSDComputerName to: " & sNewComputerName

Else

wscript.echo "Computer set to receive a standard name, continuing as is."

End If

 

 

 

 

 

Rocket Man

 

I did the same thing but in a different way as I prefer not to use scripts where I can. (I like to keep things simple!!!)

 

I added a "Set Task Sequence Variable" step to my task sequence for OSDComputerName with the value of %_SMSTSMachineName%, this will look up the name of the computer in SCCM and use this as the computer name for the new image.

 

Now if you have a unknown computer and are prompted to enter a value for OSDComputerName at the start of the task sequence, you need to stop the "Set Task Sequence Variable" step from overwritting the current value for OSDComputerName. To do this I changed the options for the "Set Task Sequence Variable" step in the task sequence to only run if this "Task Sequence Variable" does not exist.

 

Therefore I can use the same Task Sequence for known and unknown computers in SCCM, I just need to deploy the Task Sequences to the relevant collections.

 

I hope this helps someone.

Share this post


Link to post
Share on other sites
I added a "Set Task Sequence Variable" step to my task sequence for OSDComputerName with the value of %_SMSTSMachineName%, this will look up the name of the computer in SCCM and use this as the computer name for the new image.

djkarl, I'm going to try your method. Can you tell me where you added your new task sequence step in the list of steps? Here's what I have now, but not sure if the variable is in the right place...

tasksequencevariable-X3.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×