Get the Active Directory forest functional level
Get the Active Directory forest functional level

Get the Active Directory forest functional level

Script :

import-module activedirectory
Get-ADForest | select forestmode

<>

My Powershell script categories


Reference
Get-ADForest
Syntax
Get-ADForest [-Current { | }] [-AuthType { | }] [-Credential ] [-Server ] []
Current

AuthType

Credential

Server

Get-ADForest [-Identity] [-AuthType { | }] [-Credential ] [-Server ] []
Identity

AuthType

Credential

Server

Detailed Description
The Get-ADForest cmdlet gets the Active Directory forest specified by the parameters. You can specify the forest by setting the Identity or Current parameters.

The Identity parameter specifies the Active Directory forest to get. You can identify a forest by its fully qualified domain name (FQDN), DNS host name, or NetBIOS name. You can also set the parameter to a forest object variable, such as $ or you can pass a forest object through the pipeline to the Identity parameter.

To retrieve the forest of the local computer or current logged on user (CLU) set the Current parameter to LocalComputer or LoggedOnUser. When you set the Current parameter, you do not need to set the Identity parameter.

When the Current parameter is set to LocalComputer or LoggedOnUser, the cmdlet uses the Server and Credential parameter values to determine the domain and the credentials to use to identify the domain of the forest according to the following rules.

-If both the Server and Credential parameters are not specified:
–The domain is set to the domain of the LocalComputer or LoggedOnUser and a server is located in this domain. The credentials of the current logged on user are used to get the domain.

-If the Server parameter is specified and the Credential parameter is not specified:
–The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the LocalComputer or LoggedOnUser. Then the credentials of the current logged on user are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.

-If the Server parameter is not specified and the Credential parameter is specified:
–The domain is set to the domain of the LocalComputer or LoggedOnUser and a server is located in this domain. Then the credentials specified by the Credential parameter are used to get the domain.
If the Server and Credential parameters are specified:
The domain is set to the domain of the specified server and the cmdlet checks to make sure that the server is in the domain of the the LocalComputer or LoggedOnUser. Then the credentials specified by the Credential parameter are used to get the domain. An error is returned when the server is not in the domain of the LocalComputer or LoggedOnUser.

Get the Active Directory forest functional level

Leave a Reply

Your email address will not be published.