PowerShell Logo Small

Set-ADOrganizationalUnit



This is the built-in help made by Microsoft for the command 'Set-ADOrganizationalUnit', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Modifies an Active Directory organizational unit.

SYNTAX


Set-ADOrganizationalUnit [-Identity] <ADOrganizationalUnit> [-Add <Hashtable>] [-AuthType {Negotiate | Basic}] [-City <String>] [-Clear <String[]>] [-Country <String>]
[-Credential <PSCredential>] [-Description <String>] [-DisplayName <String>] [-ManagedBy <ADPrincipal>] [-Partition <String>] [-PassThru] [-PostalCode <String>]
[-ProtectedFromAccidentalDeletion <Boolean>] [-Remove <Hashtable>] [-Replace <Hashtable>] [-Server <String>] [-State <String>] [-StreetAddress <String>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-ADOrganizationalUnit [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-PassThru] [-Server <String>] -Instance <ADOrganizationalUnit> [-Confirm] [-WhatIf]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-ADOrganizationalUnit cmdlet modifies the properties of an Active Directory organizational unit. You can modify commonly used property values by using the cmdlet
parameters. Property values that are not associated with cmdlet parameters can be modified by using the Add, Replace, Clear, and Remove parameters.


The Identity parameter specifies the Active Directory organizational unit to modify. You can identify an organizational unit by its distinguished name (DN) or GUID.


You can also set the Identity parameter to an object variable such as $<localADOrganizationalUnitObject>, or you can pass an object through the pipeline to the Identity
parameter. For example, you can use the Get-ADOrganizationalUnit cmdlet to retrieve an organizational unit object and then pass the object through the pipeline to the
Set-ADOrganizationalUnit cmdlet.


The Instance parameter provides a way to update an organizational unit object by applying the changes made to a copy of the object. When you set the Instance parameter to a
copy of an Active Directory organizational unit object that has been modified, the Set-ADOrganizationalUnit cmdlet makes the same changes to the original organizational unit
object. To get a copy of the object to modify, use the Get-ADOrganizationalUnit object. When you specify the Instance parameter you should not pass the Identity parameter.
For more information about the Instance parameter, see the Instance parameter description.


For more information about how the Instance concept is used in Active Directory cmdlets, type Get-Help about_ActiveDirectory_Instance.


For AD LDS environments, the Partition parameter must be specified except in the following two conditions:

-- The cmdlet is run from an Active Directory provider drive.
-- A default naming context or partition is defined for the AD LDS environment. To specify a default naming context for an AD LDS environment, set the
msDS-defaultNamingContext property of the Active Directory directory service agent (DSA) object (nTDSDSA) for the AD LDS instance.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291123
Get-ADOrganizationalUnit
New-ADOrganizationalUnit
Remove-ADOrganizationalUnit

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Set-ADOrganizationalUnit -Identity "OU=UserAccounts,DC=FABRIKAM,DC=COM" -Description "This Organizational Unit holds all of the users accounts of FABRIKAM.COM"



This command sets the description of the OrganizationalUnit with distinguished name OU=UserAccounts,DC=FABRIKAM,DC=COM.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Set-ADOrganizationalUnit -Identity "OU=UserAccounts,DC=FABRIKAM,DC=COM" -ProtectedFromAccidentalDeletion $false



This command sets the ProtectedFromAccidentalDeletion property to $False on the OrganizationalUnit with distinguished name OU=UserAccounts,DC=FABRIKAM,DC=COM.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>Set-ADOrganizationalUnit -Identity "OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM" -Country "AU" -StreetAddress "45 Martens Place" -City Balmoral -State
QLD -PostalCode 4171 -Replace @{co="Australia"}



This command sets the Country, City and State, PostalCode, and Country properties on the OrganizationalUnit OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM.




-------------------------- EXAMPLE 4 --------------------------

PS C:\>$EuropeSalesOU = Get-ADOrganizationalUnit -Identity "OU=Europe,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM"
$EuropeSalesOU.Country = "UK"
$EuropeSalesOU.StreetAddress = "22 Station Rd"
$EuropeSalesOU.City = "QUARRINGTON"
$EuropeSalesOU.PostalCode = "NG34 0NI"
$EuropeSalesOU.co ="United Kingdom"
Set-ADOrganizationalUnit -Instance $EuropeSalesOU



This command creates a new organizational unit using the OrganizationalUnit OU=Europe,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM as a template.




-------------------------- EXAMPLE 5 --------------------------

PS C:\>Set-ADOrganizationalUnit -Identity "OU=Managed,DC=AppNC" -Server "FABRIKAM-SRV1:60000" -Country "UK"



This command sets the Country property of the OrganizationalUnit OU=Managed,DC=AppNC in an AD LDS instance.




-------------------------- EXAMPLE 6 --------------------------

PS C:\>Get-ADOrganizationalUnit -Identity ""AccountingDepartment"" | Set-ADOrganizationalUnit -ManagedBy "PattiFullerGroup"



This command modifies the ManagedBy property for the SecurityLevel2AccessGroup object. The command uses the Get-ADOrganizationalUnit cmdlet to get the AccountingDepartment
organizational unit, and then passes the object to the current cmdlet by using the pipeline operator.




-------------------------- EXAMPLE 7 --------------------------

PS C:\>$OrganizationalUnit = Get-ADOrganizationalUnit -Identity "AccountingDepartment"
PS C:\> $OrganizationalUnit.ManagedBy = "PattiFullerGroup"
PS C:\> Set-ADOrganizationalUnit -Instance $OrganizationalUnit



This example modifies the ManagedBy property for the AccountingDepartment organizational unit. The example modifies a local instance of the AccountingDepartment
organizational unit and then specifies the Instance parameter for the current cmdlet as the local instance.