Networking & Computer Hacks, Android phone apps & Games

Wednesday 10 October 2018

How to move Computers from one OU to another

How to move Computers from one OU to another using Powershell

Hi, 
After lots of googling I have found many ways to do this work done but this is the easiest way I have found.
First of all you need to know what is the Distinguished Name of every Object you work.
To get Organization Unit DistinguishedName run this command first.
Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -A
After this you will get all OU's distinguished name, copy OU's distinguished name which you want to move your object Computer or User.
Now to MOVE computer
Move-ADObject -Identity "Your computer Name" -TargetPath “Organization Unit DistinguishedName
 Example: 
Move-ADObject -Identity "Comp1" -TargetPath “OU= Hebbal,OU=Bangalore,OU=India,DC=emkayglobal,DC=net
In this example I want to move Comp1 computer in “Hebbal” OU. What you seeing in example is complete Distinguished Name’s so don’t get confused.

No comments:

Post a Comment