Renaming an OU
This topic explains how to use the Active Directory module for Windows PowerShell to rename an organizational unit (OU).
Example
The following example demonstrates how to rename the OU ManagedGroups to Groups in the Fabrikam.com domain:
Rename-ADObject "OU=ManagedGroups,OU=Managed,DC=Fabrikam,DC=Com" -NewName Groups
Rename-ADObject "OU=ManagedGroups,OU=Managed,DC=Fabrikam,DC=Com" -NewName Groups
Additional information
The following property value is used when you rename an Active Directory object:
- NewName
Finding an OU
This topic explains how to use the Active Directory module for Windows PowerShell to find an organizational unit (OU).
Example
The following example demonstrates how to find the OU Test in the Fabrikam.com domain:
Get-ADOrganizationalUnit -Identity Test, | ft Name,Country,PostalCode,City,StreetAddress,State -A
Get-ADOrganizationalUnit -Identity Test, | ft Name,Country,PostalCode,City,StreetAddress,State -A
Additional information
In addition to the standard Lightweight Directory Access Protocol (LDAP) attributes, you can retrieve the following extended properties of the Get-ADOrganizationalUnit cmdlet by using the -Properties parameter:
- StreetAddress
- City
- State
- Country
- PostalCode
- Description
- DisplayName
- ProtectedFromAccidentalDeletion
- AppliedGroupPolicies
Modifying an OU
This topic explains how to use the Active Directory module for Windows PowerShell to modify an attribute of an organizational unit (OU).
Example
The following example demonstrates how to modify the description attribute of the OU Accounting in the Fabrikam.com domain:
Set-ADOrganizationalUnit –Identity Accounting -Description "Accounting Department"
Set-ADOrganizationalUnit –Identity Accounting -Description "Accounting Department"
Additional information
You can use the following parameters when you set many of the common values that are associated with the modification an OU:
- Country
- City
- PostalCode
- State
- StreetAddress
- Description
- DisplayName
- ProtectedFromAccidentalDeletion
- ManagedBy
Moving an OU
This topic explains how to use the Active Directory module for Windows PowerShell to move an organizational unit (OU).
Example
The following example demonstrates how to move the OU ManagedGroups to the OU Managed:
Move-ADObject "OU=ManagedGroups,DC=Fabrikam,DC=Com" -TargetPath "OU=Managed,DC=Fabrikam,DC=Com"
If the Protect from Accidental Deletion option is enabled on the OU to be moved, an “Access denied” message appears when you attempt to perform this operation.
Move-ADObject "OU=ManagedGroups,DC=Fabrikam,DC=Com" -TargetPath "OU=Managed,DC=Fabrikam,DC=Com"
If the Protect from Accidental Deletion option is enabled on the OU to be moved, an “Access denied” message appears when you attempt to perform this operation.
Additional information
For a full explanation of the parameters that you can pass to Move-ADObject, at the Active Directory module command prompt, type Get-Help Move-ADObject -detailed, and then press ENTER.