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/