Solved

Changing OU name using powershell

Posted on 2014-10-13
4
231 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

860 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