Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

How to Move users from one OU to another

$
0
0

Hi,

 

I have a query to move bulk users accounts from different OU's to one OU. Can anyone pls help me to complete this task using Power Shell. Thanks. 

 

I used below command to fetch the user information from AD. 

 

Get-ADUser -Filter { office -like 'xyz'} -Properties Name,Company -SearchBase "DC=abc,DC=COM" this command is used to fetch the users from different OU's and they are in one office location assume xyz. Now i need to move all of them to one OU lets say US. which command will i join with this command? I tried below command but wasn't able to accomplish the task. 

 

Get-ADUser -Filter { office -like 'xyz'} -Properties Name,Company -SearchBase "DC=abc,DC=COM"  | Move-ADObject -targetOU "DN of target OU"

After running this command i got the error message of Access Denied. I don't know why :( i can move users from one OU to another from DSA.MSC 

 

Regards,

Riaz...

rizi.jbutt@skype


Viewing all articles
Browse latest Browse all 6937

Trending Articles