PowerShell Logo Small

Set-ADOrganizationalUnit



This is the built-in help made by Microsoft for the command 'Set-ADOrganizationalUnit', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 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 <ADAuthType>] [-City <String>] [-Clear <String[]>]
[-Country <String>] [-Credential <PSCredential>] [-Description <String>] [-DisplayName <String>] [-ManagedBy <ADPrincipal>] [-Partition
<String>] [-PassThru [<SwitchParameter>]] [-PostalCode <String>] [-ProtectedFromAccidentalDeletion <Boolean>] [-Remove <Hashtable>] [-Replace
<Hashtable>] [-Server <String>] [-State <String>] [-StreetAddress <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]
Set-ADOrganizationalUnit [-AuthType <ADAuthType>] [-Credential <PSCredential>] [-PassThru [<SwitchParameter>]] [-Server <String>] -Instance
<ADOrganizationalUnit> [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]] [<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, see about_ActiveDirectory_Instance.


The following examples show how to modify the ManagedBy property of an organizational unit object by using three methods:


-By specifying the Identity and the ManagedBy parameters


-By passing an organizational unit object through the pipeline and specifying the ManagedBy parameter


-By specifying the Instance parameter.


Method 1: Modify the ManagedBy property for the "AccountingDepartment" organizational unit by using the Identity and ManagedBy parameters.


Set-ADOrganizationalUnit -Identity "AccountingDepartment" -ManagedBy "SaraDavisGroup"


Method 2: Modify the ManagedBy property for the "AccountingDepartment" organizational unit by passing the "AccountingDepartment"
organizational unit through the pipeline and specifying the ManagedBy parameter.


Get-ADOrganizationalUnit -Identity ""AccountingDepartment"" | Set-ADOrganizationalUnit -ManagedBy "SaraDavisGroup"


Method 3: Modify the ManagedBy property for the "AccountingDepartment" organizational unit by using the Windows PowerShell command line to
modify a local instance of the "AccountingDepartment" organizational unit. Then set the Instance parameter to the local instance.


$organizational unit = Get-ADOrganizationalUnit -Identity "AccountingDepartment"


$organizational unit.ManagedBy = "SaraDavisGroup"


Set-ADOrganizationalUnit -Instance $organizational unit.


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/?LinkID=219351
Get-ADOrganizationalUnit
New-ADOrganizationalUnit
Remove-ADOrganizationalUnit

REMARKS

<

Examples


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

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



Description

-----------

Sets the description of the OrganizationalUnit with distinguishedName OU=UserAccounts,DC=FABRIKAM,DC=COM.




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

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



Description

-----------

Sets the ProtectedFromAccidentalDeletion property to $false on the OrganizationalUnit with distinguishedName
OU=UserAccounts,DC=FABRIKAM,DC=COM.




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

C:\PS>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"}



Description

-----------

Sets the Country, City and State, PostalCode and co properties on the OrganizationalUnit
'OU=AsiaPacific,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM'.




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

C:\PS>$EuropeSalesOU = Get-ADOrganizationalUnit "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



Description

-----------

Creates a new OrganizationalUnit using the OrganizationalUnit 'OU=Europe,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM' as a template.




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

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



Description

-----------

Set the Country property of the OrganizationalUnit 'OU=Managed,DC=AppNC' in an AD LDS instance.