Follow Us : Follow us on Twitter Join our Facebook Group Connect with us on LinkedIn
  Home   Forums   Blogs    Wiki    Downloads    FAQs    Newsletter   Email Lists   TV    Shop   Donate   Quick View   Contribute    File Sharing    Old Site

 HTA script to rename computer and add to OU

Author Message
nielsvd

  • Total Posts : 39
  • Scores: 0
  • Reward points : 3070
  • Joined: 2/25/2009
  • Status: offline
HTA script to rename computer and add to OU - Monday, June 22, 2009 9:47 AM ( #1 )
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 : 1069
  • Scores: 48
  • Reward points : 11600
  • Joined: 9/22/2006
  • Location: San Antonio, TX
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 9:49 AM ( #2 )
interested as well...
My Blog:(SMS,SCCM/ConfigMgr,OSD,MDT,Overall Systems Management)
http://myitforum.com/cs2/blogs/cnackers/default.aspx

MCTS ConfigMgr/MDT
nickmo

  • Total Posts : 415
  • Scores: 43
  • Reward points : 8710
  • Joined: 8/25/2008
  • Location: Denver
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:13 AM ( #3 )
nickmo

  • Total Posts : 415
  • Scores: 43
  • Reward points : 8710
  • Joined: 8/25/2008
  • Location: Denver
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:16 AM ( #4 )
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 : 310
  • Joined: 10/6/2006
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 10:36 AM ( #5 )
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 : 5850
  • Joined: 7/18/2006
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 11:45 AM ( #6 )
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 : 919
  • Scores: 38
  • Reward points : 5820
  • Joined: 6/14/2006
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, June 22, 2009 2:32 PM ( #7 )
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
  • Status: offline
RE: HTA script to rename computer and add to OU - Tuesday, June 23, 2009 3:58 AM ( #8 )
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 : 310
  • Joined: 10/6/2006
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, July 06, 2009 10:37 AM ( #9 )
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 : 310
  • Joined: 10/6/2006
  • Status: offline
RE: HTA script to rename computer and add to OU - Monday, July 13, 2009 12:50 PM ( #10 )

Jump to:

Current active users
There are 0 members and 1 guests.
Icon Legend and Permission
  • New Messages
  • No New Messages
  • Hot Topic w/ New Messages
  • Hot Topic w/o New Messages
  • Locked w/ New Messages
  • Locked w/o New Messages
  • Read Message
  • Post New Thread
  • Reply to message
  • Post New Poll
  • Submit Vote
  • Post reward post
  • Delete my own posts
  • Delete my own threads
  • Rate post

© 2000-2009 ASPPlayground.NET Forum Version 3.6