Jump to content


anyweb

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

Recommended Posts

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

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

 

Hi Rocket Man,

 

Thanks for your script!

At what time do you execute this in your TS?

 

Do you put this inside a vbs file which you execute through a package?

 

Thanks for some more explanation!

 

Filip

Share this post


Link to post
Share on other sites

Yes you create a package from it. It should be a VBS script so give it a name to suit i:e promptforsystemname.vbs etc...

There is no need to create a program for this package as you will be calling it via a run command Line task.

In the TS editor, attach a run command line task directly after Disk Partitioning and tick the box to add a package (select the promptforsystemname package) and in the command line window enter in promptforsystemname.vbs OR whatever you have called the script.

That's it. Once the disk partitioning is done the script will run and you will be required to enter in a computer name..

 

There are of course other more complex scripts available that have some validation checks (dummy proof) like non special characters allowed, no NetBIOS names may exceed 15 characters etc..

 

There are also other scripts with the use of MDT integration that can auto-name systems to the serial number of the system. This works good on most muti-national vendors but for some vendors it's a pain as some serial numbers are extensively long so the auto-naming fails, but with some script trickery you can overcome this, on most vendors (not them all as I have recently found out).

Share this post


Link to post
Share on other sites

Yes you create a package from it. It should be a VBS script so give it a name to suit i:e promptforsystemname.vbs etc...

There is no need to create a program for this package as you will be calling it via a run command Line task.

In the TS editor, attach a run command line task directly after Disk Partitioning and tick the box to add a package (select the promptforsystemname package) and in the command line window enter in promptforsystemname.vbs OR whatever you have called the script.

That's it. Once the disk partitioning is done the script will run and you will be required to enter in a computer name..

 

There are of course other more complex scripts available that have some validation checks (dummy proof) like non special characters allowed, no NetBIOS names may exceed 15 characters etc..

 

There are also other scripts with the use of MDT integration that can auto-name systems to the serial number of the system. This works good on most muti-national vendors but for some vendors it's a pain as some serial numbers are extensively long so the auto-naming fails, but with some script trickery you can overcome this, on most vendors (not them all as I have recently found out).

 

Hi,

 

I just created the package added it to my TS, but when running it, I got an error: Expected end of statement (Line 17, char 68).

It seems it faulted on the &

 

I now replaced it with a + and am retrying to run the script.

Share this post


Link to post
Share on other sites

Hi guys,

 

I'm having some real problems with this. I'm currently using Config Manager 2012 R2, fully patched. I have a TS setup which deploys to pre-existing clients no problems (it uses their existing computer names), however, unknown computers keep failing. What I've noticed on a new machine when deploying Winodws 8.1 is the following;

  • PXE Boot
  • Select TS
  • Get prompt for OSDComputerName (as previously setup and working in 2012 SP1)
  • Manually specify the machine name
  • TS begins (partitions, applies the image)
  • An 'unknown' device then appears in the All Systems collection
  • After driver packagesare installed I see a screen displaying the Win8 logo and a message saying "Getting Ready"
  • This screens sits there for a long time (on a known machine it goes through very quickly)
  • At some point the machine reboots and displays the "Get Online" screen (as normally shown in OOBE), not a part of the usual TS
  • I click through that and the TS resumes and seemingly completes, however, the machine is not joined to the domain (and I cannot log into it)

On a known machine, using the same TS, it all goes through without issue.

 

I have tried the method used in this article, as well as the vbs script mentioned by Rocket Man as well as the TS variable method mentioned by djkarl - all result in the same failure. I have experienced this on a number of different new machines (we are a school and had a few new models come in this year).

 

Any tips or suggestions would be greatly appreciated!

Edited by Schikitar

Share this post


Link to post
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.