Solved

Changing OU name using powershell

Posted on 2014-10-13
4
261 Views
Last Modified: 2014-11-20
trying to rename an organisational unit using the follow code in powershell:

rename-adobject -identity "OU=Users,OU=koopus,DC=qessar,DC=com" -newname "klipsy"

but it throws back this error:
rename-adobject : Directory object not found
At line:1 char:1
+ rename-adobject -identity "CN=Users,OU=koopus,DC=qessar,DC=com" -newname "klipsy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (CN=Users,OU=koopus,DC=qessar,DC=com:ADObject) [Rename-ADObject], ADIden
   tityNotFoundException
    + FullyQualifiedErrorId : ActiveDirectoryCmdlet:Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException,M
   icrosoft.ActiveDirectory.Management.Commands.RenameADObject
0
Comment
Question by:Ikky786
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Expert Comment

by:Miguel Angel Perez Muñoz
ID: 40376722
Appears powershell can not read thos OU, maybe it is not correctly write or has not enough privileges to read it.
0
 
LVL 13

Expert Comment

by:Rizzle
ID: 40376779
Have you ran this from a domain controller whilst being logged in as an administrator? did you run Powershell as administrator when doing this?
0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40377269
Are you trying to rename the User folder to "klipsy" or do you mean to rename "koopus" to "klipsy" ?
0
 
LVL 10

Accepted Solution

by:
Michael Ian Claridge earned 500 total points
ID: 40383639
Hello,

The User container in AD has a flag set specifically so it cannot be changed. (It is not an OU).
However if you want to rename the OU "koopus", sometimes typing the DN letter perfect cannot find the OU...very bizarre but you can search for the OU first and then pipe it as below.

Please do not forget to assign points once you have an answer.

Get-ADObject -filter {ObjectClass -eq "OrganizationalUnit"} | where {$_.DistinguishedName -eq "OU=koopus,DC=qessar,DC=com"} | Rename-ADObject -NewName "klipsy"

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to dynamically set the form action using jQuery.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question