Re: Moving machine accounts from one ou to another
- From: "Laura E. Hunter [MVP]" <nospamplease>
- Date: Tue, 17 Jan 2006 20:45:29 -0500
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.
>
.
- Follow-Ups:
- Re: Moving machine accounts from one ou to another
- From: Richard Mueller
- Re: Moving machine accounts from one ou to another
- References:
- Moving machine accounts from one ou to another
- From: ButlerKevinD
- Moving machine accounts from one ou to another
- Prev by Date: Re: ADAM "add application partition" using LDIFDE
- Next by Date: remote branch office setup: Internal DNS
- Previous by thread: Re: Moving machine accounts from one ou to another
- Next by thread: Re: Moving machine accounts from one ou to another
- Index(es):
Relevant Pages
|