#75216 - 2003-05-3002:17 AMJoinAD KiXforms script to move computers into Active Directory
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11625
Loc: CA
This script is a KiXforms script created to help desktop support people to Move computers into the Active Directory under a specific OU container.
You can easily modify the OU paths to your specific Network requirements to use in your environment.
UPDATED CODE June 10, 2003
Requirements to run this script: 1. Active Directory (can run script for testing without AD) 2. KiXtart v4.x (preferred v4.21) 3. KiXforms v2.3.0 Beta 2 http://www.kixforms.com/assets/index.htm 4. NETDOM.EXE from Microsoft
NOTE NETDOM does not support NT 4 well for moving to a specific OU in Active Directory
#75217 - 2003-05-3010:11 AMRe: JoinAD KiXforms script to move computers into Active Directory
RadimusRadimus Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if you look at McafeeManager you will find a function that enums AD OUs for OUs containing computers
I believe that InContainer() will return the distinguished name/AD path of a given PC and a LDAP function will move the PC without requiring the dependance on netdom
So basically you could either default it to look into a specific computer OU and enum all the computers in it, or search for the computer acct where ever it was and then enumm all OUs with computer accounts as listbox/combobox as the destination and then a move and cancel button
combobox1: enumed list of OU's to enum computer accounts to populate comboxbox2 combobox2: if box1 blank then computer acct to search for or enumed list of computers in OU selected in box1 Combobox3: destination OU button1: move, check computer acct is not already in destination OU button2: quit
#75218 - 2003-05-3008:20 PMRe: JoinAD KiXforms script to move computers into Active Directory
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11625
Loc: CA
Rad,
Thanks for the feedback and information. Very good suggestions which may apply to some Companies out there.
1. I think this LDAP move is only for a computer that is already in the AD. In our case the Computer is not in AD, it is a freshly ghosted image that we are adding to the AD typically from Workgroup. If you know or find an ADSI/WMI call that can do it without the need for NETDOM.EXE that would be cool.
2. Not sure about other Companies, but we have 100's and 100's of OUs for Computers. That is why I don't enum them. For our business unit they typically will only go into 1 of 3 locations, so spending the time to enum all the OUs is not very efficient. Perhaps someone that is an Enterprise Admin in our Company that might want to do this in any of the OUs might want to use the enum process. Or smaller Companies.
3. Would really like to find a valid method to add NT 4.0 systems to the AD... If I can use AD Users and Computers to manually add a computer to an OU and set it to be assigned to pre-2000 then I would think I should be able to do it in script as well... Just need to find that method. As you say, if that could be done, then wouldn't need NETDOM.EXE at all
This will only ask for the computername during install off the ghosted image, and the computer will join AD in the OU: NewPC
This ofcourse requires than you have added the OU: NewPC to the root of the domain, and created the user: win2kAddUser
In My domain the user: win2kAddUser is a domain user with elevated priveliges to the OU: NewPC (win2kAddUser can add computers to OU: NewPC) NOT a DomainAdmin as stated in the Identification section, but this is enough!
Don't be afraid of the password in plain text in sysprep.inf, because the folder: C:\Sysprep is automatically removed during the first boot, so it's sort of paranoia to make the special user: 2kAddUser
You can now use the LDAP: move computer (Something like this)
You could overcome this by make making a ghosted image before using sysprep, and then use a different sysprep.inf for each domain. Sysprep it, and make a new ghost-image from here. Reload the not-sysprepped image and make a new image using a different sysprep.inf for the next domain.
This way you can create a different image for each domain.