Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving PC Objects

Status
Not open for further replies.

kachbo1

IS-IT--Management
Nov 16, 2004
40
0
0
GB
Hi,

I have a txt file which consists of PC Names (PC's within a particular dept).

I would like to move these PC's (listed in the txt file) from its existing OU to another OU.

Can somebody please provide me with a script to do this.

Thanks

Kachbo.
 
what have you got so far?

how about the .MoveHere here method?
 
You can use dsquery piping result into dsmove, all can be done from commandline in one loop... something like this :

Code:
dsquery computer ou=sales,dc=microsoft,dc=com -limit 1000|dsmove computer -newparent OU=Marketing,DC=Microsoft,DC=Com

Anyway... you must replace the OU=/DC= with the name wich matches your domain. Also beware of the -limit. In this ex, I used -limit 1000, if omitted default is 100. That means that if you have more than 100 computers in the OU, the script will stop after proccessing 100 object.

Hope this was helpfull...
 
.MoveHere is a method of the IADsContainer class, perhaps therefore it doesnt apply to IADsComputer objects. seems silly that it wouldnt work. the documentation say

Moves(or renames) an object within the directory

migth be worth a try
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top