Re: Moving machine accounts from one ou to another



Are you trying to take the entire contents of OU1 and move them to OU2?
That's going to be pretty easy:

' This code moves objects from the "old" OU to the "new" OU
' ------ SCRIPT CONFIGURATION ------
strOldOrgUnit = "<OldOrgUnitDN>" ' e.g. ou=Eng Tools,dc=rallencorp,dc=com
strNewOrgUnit = "<NewOrgUnitDN>" ' e.g. ou=Tools,dc=rallencorp,dc=com
' ------ END CONFIGURATION ---------

set objOldOU = GetObject("LDAP://"; & strOldOrgUnit)
set objNewOU = GetObject("LDAP://"; & strNewOrgUnit)
for each objChildObject in objOldOU
Wscript.Echo "Moving " & objChildObject.Name
objNewOU.MoveHere objChildObject.ADsPath, objChildObject.Name
next


Alternately, go to www.joeware.net and download adfind and admod, and you
can do something similar at the command-line:

> C:\>adfind -b "<OldOrgUnitDN>" -s onelevel -dsq | admod -move
> "<NewOrgUnitDN>"

HTH


--
Laura E. Hunter: MVP Windows Server - Networking
All replies to newsgroup, please
Post provided as-is, no warranties expressed or implied






"ButlerKevinD" <ButlerKevinD70@xxxxxxxxxxx> wrote in message
news:%23rdTfm7GGHA.2444@xxxxxxxxxxxxxxxxxxxxxxx
> Hey, does anyone here have any suggestions for or examples of scripts to
> move computer accounts from one ou to another?? i have about 6k
> workstation accounts that i would like to move to geographically named
> ou's (building they are housed in) along with segregating them based on
> their operating system. here is a basic example of what i am wanting to
> accomplish:
>
> ad root
> |
> |
> |
> machine accounts
> |
> |
> |
> bldg #1-----
> | |
> | |
> | WinNT
> | |
> | Win2k
> | |
> | WinXP
> |
> |
> bldg #2-----
> |
> |
> WinNT
> |
> Win2k
> |
> WinXP
>
> also, if there is something that is friendly to those of us who have never
> written an ADSI script, that would be extremely helpful. i'm trying to do
> this as "free" as possible. again, any suggestions would be greatly
> appreciated. thanks in advance.
>


.



Relevant Pages

  • Re: Moving machine accounts from one ou to another
    ... MVP Windows Server - Directory Services ... > workstation accounts that i would like to move to geographically named ... > written an ADSI script, ...
    (microsoft.public.windows.server.active_directory)
  • Re: unlocking multiple user accounts
    ... You can write an ADSI script for the purpose. ... There are sample scripts available in MS site for reading the user ... You can extend it to do this action. ... > locked out of their accounts. ...
    (microsoft.public.win2000.security)
  • Re: Hide Users/OU from GAL
    ... Also it could be done with ADSI script. ... Pavel Nagaev ... > simple way to select multiple accounts and enable Hide from GAL ... I know how to keep them from showing up one ...
    (microsoft.public.exchange2000.general)