Welcome to ServerForumz.com!
FAQFAQ      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:
Need a script to decide if to copy a file based on members.. - Trying to do this: IF "UserA" is a MEMBER of "GroupB" THEN COPY "\\server\share1\ShortcutC" to "c:\documents and settings\%username%\nethood\" I think I got the file copy part down, but can't figure how to do a...

script to unlock all user accounts in ad - hi all - does anyone have a script to share which would unlock all the user accounts in an active directory domain? i have found several for unlocking a specific user, but cannot see how to modify them to work en masse. tia! shad

how to change password on a multiple stand alone servers nt4 - Hi; i want change password for one or multiple users on all servers nt4 (members servers, not à dc or pdc); how to ?; thank's

Input from text file. - Is there any way I can have strComputerName pull the needed information from a text file? strComputerName = InputBox ("enter computer name")

restart computer - Can this script reboot computer across subnet? strComputer = inputbox"Enter PC name" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\ci...
   Windows Server (Home) -> Windows Server Scripting All times are: Pacific Time (US & Canada) (change)
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 ]