Welcome to ServerForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Move multiple computer accounts in a txt file from one OU ..

 
   Windows Server (Home) -> Windows Server Scripting RSS
Next:  Remote Network Driver Update  
Author Message
barryleon

External


Since: Jun 08, 2006
Posts: 1



(Msg. 1) Posted: Thu Jun 08, 2006 2:10 am
Post subject: Move multiple computer accounts in a txt file from one OU to another
Archived from groups: microsoft>public>windows>server>scripting (more info?)

I have a list of computers ID's that are quite random e.g IT1001 or
DT1563 or PC9821. So I need a script that can automatically read a text
file and move the computer accounts from the Computers container into
another OU.

I will be forever in debit to anyone that can supply me with a script
that could do this, as I have about 4500 computer's to move into 100 or
so OU's.

Many Thanks

 >> Stay informed about: Move multiple computer accounts in a txt file from one OU .. 
Back to top
Login to vote
Eng

External


Since: Nov 24, 2004
Posts: 12



(Msg. 2) Posted: Mon Aug 21, 2006 3:09 am
Post subject: Re: Move multiple computer accounts in a txt file from one OU to a [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Use this:

This script is composed by 3 file

1 input.txt the input file is used to retrieve the object name
2 the batch used to "run" the vbs and take the information from the txt
3 the VBS file move_cmp.vbs

The file BAT move a computer from CN=COMPUTERS
to ANOTHER ONE that you have to specify into the VBS
file.

That's all.

Script by: Eugenio Talarico
mailto: eugeniot @ _R_E_M_O_V_E___ larico.it

so here the structure:

1 input.txt

computer_name_1
computer:name_2

2 the batch file

@echo off

echo ****************************************
Echo * script to move computers*
echo ****************************************


for /F %%1 in (input.txt) do (
cscript move_cmp.vbs %%1 //B //Nologo >> err_log.txt 2>>&1 )

3 the VBS move_cmp.vbs FILE

dim nomepc
ParseCommandLine()


Const ADS_PROPERTY_APPEND = 3
Set objRootDSE = GetObject("LDAP://rootDSE")


'*****************************************************************************
'* INTO STRVARIABL LINE PUT THE PATH WHERE THE object will be moved
'* (EX: strVariabl = ",OU=Standard Users,OU=DomainNAME,")
'*****************************************************************************
'*****************************************************************************
strVariabl = "OU=Public Desktops,OU=PIPPO,OU=PIPPO"
'*****************************************************************************
'*****************************************************************************
'*****************************************************************************
strFissa = strVariabl & "," & objRootDSE.Get("defaultNamingContext")
wscript.echo strFissa



Set objNewOU = GetObject("LDAP://"& strFissa)
Set objMoveComputer = objNewOU.MoveHere _
("LDAP://CN="& nomepc & ",CN=Computers," &
objRootDSE.Get("defaultNamingContext"), "CN=" &nomepc)


Sub ParseCommandLine()
Dim vArgs

set vArgs = WScript.Arguments

if vArgs.Count <> 1 then
DisplayUsage()
Else
nomepc = vArgs(0)
End if
End Sub

 >> Stay informed about: Move multiple computer accounts in a txt file from one OU .. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
move computer accounts to a new OU - How could I move hundreds of computer accounts in an OU to another OU? When I use the example in" The Portable script Center", it returns "There is no such object on the server", do I need to run it only on the DC? thanks,

Move computer accounts into OU - We have decided to clean up our ad and as such need to move all the computer accounts in specific OU's. I can match the user name from the phone book but i wanted to know if there was any way of just moving a bunch of names at one single time.

Bulk move of computer accounts between OU's - Hi, I am very new to scripting. I want to move 500 computers account from one OU to another. I worked on the following script to somehow pass the argument through the command prompt ot text file. ----------------------------- sComputer= "CN=Test&...

Trying to Move user accounts to a different OU - I have about 1000 users I need to move to a different OU. The problem I am running into is the name. Some accounts are LastNFirstNMI and others are LastN, FirstN MI. . I was able to the move the accounts that LFMi but the later is causing problems. I...

Move user accounts from one OU to another - Any help is appreciated, I am trying to move a text file list of user accounts from OU to another. Thank you.
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]