Jump to content


anyweb

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

Recommended Posts

theyssensf and Rocket Man: How can you modify this script so it checks in the AD if the computername is already there?



I use SCCM 2012 SP1 and im trying to make my OSD smarter.




As it is now I use about 12 Device Collections where I put the computers in SCCM in, depending on which Win7 language and which OU they need to go into in the AD. In each of my 12 device collections I have set Collection Variables with OSDDOMAINOUNAME(put computer in correct OU in the AD, OSDInputLocale, OSDSystemLocale, OSDUILanguage and OSDUserLocale (to set correct regional settings depending on which country the computer will go to).



Will it work in a SCCM OSD TS with prompting for OSDComputerName if I set a step in my TS with this script ?

Share this post


Link to post
Share on other sites

This is how our organization prompts for the computername.

 

I'd like to prepopulate the 'value' field to have the servicetag/ serial number.

(referenced step from above)

http://www.windows-noob.com/forums/index.php?app=core&module=attach&section=attach&attach_rel_module=post&attach_id=7342

 

The servicetag/ serialnumber is part of our naming convention and having it prepopulated would be 'helpful'.

 

Is this possible? If so, how would I go about doing such.

Thanks in advance.

-Matlock

Share this post


Link to post
Share on other sites

Here you've got a starting point. This is a simple HTA that asks for a computername. After pressing the button it will be added as a task sequence variable.

<HTML>
<HEAD>
<TITLE>© 2012 - P.T. van der Woude - Inovativ</TITLE>
<HTA:APPLICATION
  APPLICATIONNAME="HTASetComputerName"
  ID="objNewApplication"
  VERSION="0.9.6"
  BORDER="thin"
  MAXIMIZEBUTTON="no"
  MINIMIZEBUTTON="no"
  SINGLEINSTANCE="yes"/>
</HEAD>
<SCRIPT LANGUAGE="VBScript">

Sub Window_OnLoad()
	' Set Window Size and Location
	Window.resizeTo 450,210
	Window.moveTo (screen.width - document.body.clientwidth)/2, (screen.height - document.body.clientheight)/2
	
	' Set TSProgressUI Object
	Set objTSProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
	objTSProgressUI.CloseProgressDialog()
End Sub

Sub SetOSDComputerName()
	' Set TSEnvironment Object
	Set objTSEnvironment = CreateObject("Microsoft.SMS.TSEnvironment")
	
	' Set Task Sequence Variable OSDComputerName
	objTSEnvironment("OSDComputerName") = newComputerNameBox.value
	
	' Close Window
	Window.Close()
End Sub

</SCRIPT>
<BODY>
    <TABLE BORDER='0' WIDTH='100%' ID='AppTable' STYLE="font:12 pt calibri;table-layout:fixed">
	<TR><TD COLSPAN='2'><img src="Logo_Inovativ.gif" alt="Logo_Inovativ" /></TD><TD COLSPAN='1'><B>Provide a computer name</B></TD></TR>
	<TR><TD ID = 'ComputerNameLabel' COLSPAN='2' VALIGN='top'></TD>
		<TD ID = 'ComputerNameBox' COLSPAN='1'><input type="text" name="newComputerNameBox" size="75" maxLength="15"></TD>
	<TR><TD COLSPAN='2' VALIGN='top'></TD>
		<TD COLSPAN='1'><BUTTON style="width:120;height:25" input id=runbutton name="Ok_button" onClick="SetOSDComputerName">Ok</BUTTON></TD></TR>
	<TR><TD STYLE='font-size:9pt' COLSPAN='2' VALIGN='bottom'><B>Blog:</B> <A HREF="http://www.petervanderwoude.nl">www.petervanderwoude.nl</A></TD>
	<TD STYLE='font-size:9pt' COLSPAN='1' VALIGN='bottom'><B>Twitter:</B> <A HREF="http://twitter.com/pvanderwoude">pvanderwoude</A></TD></TR></TABLE>
</BODY>
</HTML>

Share this post


Link to post
Share on other sites

Thank you Peter.

 

I've stumbled upon the following

 

---
This is a vbs script sets the computername variable to the serial number

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

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

 

The next vbs script I found presents a 'computername dialogue box'
-

set env = CreateObject("Microsoft.SMS.TSEnvironment")

Name = inputbox("Enter the name for the new computer" ,"Prompt for Computer Name:",env("_SMSTSMachineName"),400,0)

env("OSDComputerName") = Name

****This prompting script- prepopulates the 'computername' field with the 'current' computer name.
----

I'm trying to combine the two vbs scripts such that in the vbs script which prompts for the computername (that has the current computername prepopulated) instead prepopulates with the serial number.

Given my lack of ability and knowledge of how vbs scripting works, I was hoping the community could help.

 

Thanks for any assistance and guidance.

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.