?
Solved

Changing OU name using powershell

Posted on 2014-10-13
4
Medium Priority
?
274 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

801 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