Page 1 of 1 1
Topic Options
#85452 - 2002-04-02 08:14 PM Moving User/Computer from one OU to another
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
Hi,
does anyone have an UDF to move a User-/Computer-Account from one OU to another?
_________________________
Jens Kalski

Top
#85453 - 2002-04-02 08:54 PM Re: Moving User/Computer from one OU to another
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The following code has been tested and does move a user account in the AD. TranslateName can be found in the UDF library. If I can find some time I will formalize this and post it in the UDF section.

[edit] This original example was full of errors and was removed. The example below was supplied by JohnQ. [/edit]

Working example code.
Code:

$domain = "xyz"
$account = @userID
; OR
;$account = @wksta + "$$"
$DN = TranslateName (3, "", 3, "$domain\$account", 1)
$Object = GetObject("LDAP://$Domain/" + $DN)
$ObjectName = SubStr($DN, 1, InStr($DN,",")-1)
$NewLocation = GetObject("LDAP://$Domain/OU=someOU,DC=xyz,DC=com")
$moveit=$NewLocation.MoveHere("LDAP://" + $DN, $ObjectName)



Edited by Howard Bullock (2004-01-13 04:56 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#85454 - 2002-04-03 10:39 AM Re: Moving User/Computer from one OU to another
JensKalski Offline
Starting to like KiXtart

Registered: 2000-12-13
Posts: 186
Loc: Germany
Thanks a lot!
_________________________
Jens Kalski

Top
#85455 - 2002-04-03 04:32 PM Re: Moving User/Computer from one OU to another
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Let me know if you encounter any problems.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2375 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.052 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org