Enable an Active Directory optional feature.

      Enable-ADOptionalFeature [-Identity] ADOptionalFeature
         [-Scope] {Unknown | ForestOrConfigurationSet | Domain}
            [-Target] ADEntity [-AuthType {Negotiate | Basic}]
               [-Credential PSCredential] [-PassThru ] [-Server string]
                  [-Confirm] [-WhatIf] [CommonParameters]

   -AuthType {Negotiate | Basic}
       The authentication method to use: Negotiate (or 0), Basic (or 1)
       A Secure Sockets Layer (SSL) connection is required for Basic authentication.

   -Credential PSCredential
       The user account credentials to use to perform this task.
       The default credentials are those of the currently logged on user unless the
       cmdlet is run from an Active Directory PowerShell provider drive.
       If the cmdlet is run from such a provider drive, the account associated with the drive is the default.

       Type a user name, such as "User64" or "Domain64\User64" or specify a
       PSCredential object such as one generated by Get-Credential 

       If a user name is specified, the cmdlet will prompt for a password.

    -Identity ADOptionalFeature
       An AD optional feature object, provide one of the following values:
       (The identifier in parentheses is the LDAP provider name for the attribute.)

          Fully qualified domain name
            Example: corp.SS64.com
          Feature GUID (featureGUID) 
            Example: 564c3d2e-f72d-4d60-8a88-030d69495f21
          Object GUID (objectGUID)
            Example: 482ab21c-823e-601e-649a-ac7643d64ec9

       The cmdlet searches the default naming context or partition to find the object.
       If two or more objects are found, the cmdlet returns a non-terminating error.

       This parameter can also get this object through the pipeline or you can set this
       parameter to an object instance.

       This example shows how to set the parameter to a distinguished name.
          -Identity  "corp.SS64.com"

       This example shows how to set this parameter to a optional feature object instance named "optFeatureInstance".
          -Identity $optFeatureInstance
       Return the new or modified object.
       By default (i.e. if -PassThru is not specified), this cmdlet does not generate any output.

   -Scope ADOptionalFeatureScope
       The scope at which the feature is enabled or disabled.
       Values for this parameter: Domain (or 0), ForestOrConfigurationSet (or 1), or in PowerShell 1.0/2.0 : Forest

   -Server string
       The AD Domain Services instance to connect to, this may be a Fully qualified domain name,
       NetBIOS name, Fully qualified directory server name (with or without port number)

   -Target ADEntity
       The domain or forest in which to modify the optional feature.
       identify the target domain or forest by providing one of the following values:  
          Fully-qualified domain name of the forest or domain
            Example: corp.SS64.com
          NetBIOS name of the forest or domain
           Example: corp
          Distinguished name of the domain naming context (domain NC)
            Example:  DC=corp,DC=SS64,DC=com

       Prompt for confirmation before executing the command.

       Describe what would happen if you executed the command without actually executing the command.

Enable-ADOptionalFeature enables an AD optional feature that is associated with a particular Domain mode or Forest mode. AD optional features that depend on a specified domain mode or Forest mode must be explicitly enabled after the domain mode or forest mode is set.

The -Identity parameter specifies the AD optional feature to enable. Identify an optional feature by its distinguished name (DN), feature GUID, or object GUID. Alternatively set the parameter to an optional feature object variable, or through the pipeline. For example, you can pipe from Get-ADOptionalFeature to Enable-ADOptionalFeature.

The -Target parameter specifies the domain or forest on which the optional feature will be enabled. You can identify the domain or forest by its fully-qualified domain name (FQDN), NetBIOS name, or the distinguished name (DN) of the domain naming context (domain NC).


Enable the optional feature 'Recycle Bin Feature' for the forest 'SS64.com'. This operation must be performed on the Domain Controller that holds the naming master FSMO role:

PS C:\> Enable-ADOptionalFeature 'Recycle Bin Feature' -Scope ForestOrConfigurationSet -Target 'SS64.com' server dc1

“Men often become what they believe themselves to be. If I believe I cannot do something, it makes me incapable of doing it. But when I believe I can, then I acquire the ability to do it even if I didn’t have it in the beginning” ~ Mahatma Gandhi

Related PowerShell Cmdlets

Disable-ADOptionalFeature - Disable an AD optional feature.
Add-WindowsFeature - Install roles, role services, and features.
Enable-WindowsOptionalFeature - Enable a feature in a Windows image.
Get-ADOptionalFeature - Get one or more AD optional features.
Add-WindowsCapability - Install a Windows capability package on the specified OS image.

Copyright © 1999-2023 SS64.com
Some rights reserved