HTA script to rename computer and add to OU

Author Message
nielsvd
  • Total Posts : 39
  • Scores: 0
  • Reward points : 3070
  • Joined: 2/25/2009
HTA script to rename computer and add to OU - Monday, June 22, 2009 9:47 AM
0
I've been busy for a couple of days not to find out how to implement a script to the OSD portion of SCCM. I want to use a HTA script including VB that asks for a computername and provide a drop-down list from which the OU can be selected where the computer is put in. Setting the Computername is solved and rather easy, but I can't get the OU placement figyred out. I hope someone out here can help me with that. It's the missing link in our deployment strategy.

cnackers
  • Total Posts : 1414
  • Scores: 61
  • Reward points : 35400
  • Joined: 9/22/2006
  • Location: Madison, WI
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 9:49 AM
0
interested as well...
My Blog
Follow me on Twitter
Microsoft MVP - System Center Configuration Manager
Most Valued Community Contributor - 2011




nickmo
  • Total Posts : 546
  • Scores: 55
  • Reward points : 36600
  • Joined: 8/25/2008
  • Location: Denver
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:13 AM

nickmo
  • Total Posts : 546
  • Scores: 55
  • Reward points : 36600
  • Joined: 8/25/2008
  • Location: Denver
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:16 AM
0
Oh wait, nevermind.  Monday morning brain needs coffee.  You cannot natively use HTA within WinPE without using MDT 2008 (or 2010) to extend the boot image.  On the link I provided is another link to Jarvis Davis's posting on the same thing.  Sorry for the confusion!

cstauffer911
  • Total Posts : 55
  • Scores: 9
  • Reward points : 7150
  • Joined: 10/6/2006
  • Location: Central PA
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:36 AM
0
I have something that i have been working on but i dont like it.
It works but i dont like that it isnt dynamic. In MDT you can use the DomainOUs.xml file and it creates this page for you but in OSD/SCCM it does not. Atleast not that i could figure out.
 
I used Todd Hemsell's blog to hack my XML and add a page for OU's.
The only way i have been able to do it so far is to create a list of ou's and add radio buttons to the page. it works but it is not dynamic so anytime you need to add more OU's to the list you would need to change the code and update the boot images. I would have rather created a link to SQL and created a table to contain the list but i have no clue where to even begine to make that happen.
 
Code for boot wizard XML
*******************************************************************
<!--############################################################################################################################-->
  <Pane id="ChooseOU">
    <Body><![CDATA[
<H1>Choose OU</H1>
<table width=90% >
 
 <tr><td colspan="4"><label class=ErrMsg id=InvalidCredentials>* Invalid credentials</label></td></tr>
<tr> Please choose the correct OU for this machine. </tr>
 
  <td colspan=2></td>

  <tr><u>Organizational Unit:</u></tr>
  <td>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\GEN\WORKSTATIONS">OU=\XXX\OA\GEN\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\CTO\WORKSTATIONS">OU=\XXX\OA\CTO\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\SHARED\WORKSTATIONS">OU=\XXX\OA\SHARED\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\Consult\WORKSTATIONS">OU=\XXX\OA\Consult\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\Mobile\WORKSTATIONS">OU=\XXX\OA\Mobile\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\JJ\WORKSTATIONS">OU=\XXX\OA\JJ\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\WRKSTN\WORKSTATIONS" CHECKED>OU=\XXX\OA\WRKSTN\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OA\TRNG\WORKSTATIONS">OU=\XXX\OA\TRNG\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\GS\DGS\WORKSTATIONS">OU=\XXX\GS\DGS\WORKSTATIONS</tr>
<tr><input TYPE="radio" NAME="DomainOUName" VALUE="OU=\XXX\OB\obco\WORKSTATIONS">OU=\XXX\OB\obco\WORKSTATIONS</tr>

  </td>
 </tr>
    </div>   
</table>    

  ]]></Body>
    <Condition>UCase(Property("SkipComputerName"))&lt;&gt;"YES" and Property("DeploymentType")&lt;&gt;"REPLACE" and Property("DeploymentType")&lt;&gt;"UPGRADE" and Property("DeploymentType")&lt;&gt;"CUSTOM" </Condition>

  </Pane>
 <!--############################################################################################################################-->
 
 
*******************************************************************
 
Hope this gets you started.

xneilpetersonx
  • Total Posts : 181
  • Scores: 1
  • Reward points : 7130
  • Joined: 7/18/2006
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 11:45 AM
0
Here is a series of articles that I have written on this subject - there are example scripts that include both computer renaming and also OU/computer object placement.

http://myitforum.com/cs2/blogs/xneilpetersonx/archive/2008/12/09/custom-osd-scripts-content-list.aspx

hope this helps.

neilp

rbennett806
  • Total Posts : 1017
  • Scores: 43
  • Reward points : 17700
  • Joined: 6/14/2006
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 2:32 PM
0
You can also check out the heavily customized HTA frontend here: http://www.myitforum.com/articles/19/view.asp?id=11652

nielsvd
  • Total Posts : 39
  • Scores: 0
  • Reward points : 3070
  • Joined: 2/25/2009
RE: HTA script to rename computer and add to OU - Tuesday, June 23, 2009 3:58 AM
0
Thanks for all your replies. I already read most of the scripts, but the thing they don't really provide is a neat way to place a computer in a certain OU. A list should dynamically be created and a OU be chosen from there. If I find something I'll let you know.

Check out this script! I haven't tested is fully, but it seems very promissing!!
<message edited by nielsvd on Tuesday, June 23, 2009 4:24 AM>

cstauffer911
  • Total Posts : 55
  • Scores: 9
  • Reward points : 7150
  • Joined: 10/6/2006
  • Location: Central PA
RE: HTA script to rename computer and add to OU - Monday, July 06, 2009 10:37 AM
0
I now have a working semi dynamic way to choose the OU. I don't think there is any real way to make it completely dynamic unless you only have a few OU's in your domain. In an environment like ours there are a few thousand OU's do this solution should work nicely.

 Thanks to Maik and Todd.

I will post it on my blog in a few day, I just need to clean up the code and finish testing then write up the blog.

I will try and post back here when the blog is posted.



cstauffer911
  • Total Posts : 55
  • Scores: 9
  • Reward points : 7150
  • Joined: 10/6/2006
  • Location: Central PA
RE: HTA script to rename computer and add to OU - Monday, July 13, 2009 12:50 PM