Home » PowerShell » Get AdUsers Enabled in Active Directory

Get AdUsers Enabled in Active Directory

Using the Get-AdUser command with Filter parameter with Enabled status equal to True, you can get adusers enabled in Active Directory.

The Get-AdUser cmdlet in PowerShell is used to get information about users in the Active Directory. The Filter parameter can be used to specify a filter that will be used to select the users based on the condition. In this case, the filter is “Enabled Status equal to True“. This means that the command will only return the users having Enabled property is equal to True.

In the active directory, the aduser object has an Enabled property that tells if the aduser is enabled or disabled in the active directory. A value of True indicates that the user account is enabled, and a value of False indicates that the account is disabled.

In this article, we will discuss how to get enabled users in the active directory using the Get-AdUser cmdlet.

Find Enabled AdUsers in Active Directory

To get the adusers enabled status and find if the user is enabled, use the Get-AdUser with Filter parameter, and check if the Enabled status is True for the user.

Get-ADUser -Filter 'Enabled -eq "True"' | Select GivenName,Enabled

In the above PowerShell script, the Get-AdUser Filter parameter uses the filter query Get-AdUser -Filter 'Enabled -eq "True"' and sends it to the Active directory to get adusers enabled status equal to true and display their given name and enabled status.

The output of the above PowerShell script to get adusers enabled in the active directory is:

Get Adusers Enabled in Active Directory
Get Adusers Enabled in Active Directory

Cool Tip: Read here to learn the Get-AdUser cmdlet with Examples!

There are other ways to find adusers enabled in the active directory like using the where condition.

Refer to the following code which uses the Get-AdUser Filter parameter to get adusers from the active directory. It pipes the results to the Where condition to get active users only.

Get-Aduser -filter * | where {$_.Enabled -eq $true } | Select GivenName, Enabled

The output of the above PowerShell script to get enabled adusers is:

PS C:\> Get-Aduser -filter * | where {$_.Enabled -eq $true } | Select GivenName, Enabled

GivenName Enabled
--------- -------
John         True
Tom          True
Erick        True
Gary         True
Chris        True
Adam         True
Don          True
Tira         True
Aron         True
Dave         True
Harsh        True
Netya        True


PS C:\>

Cool Tip: How to find disabled adusers in OU using PowerShell!

Conclusion

I hope the above article on how to get adusers enabled in the active directory using the Get-AdUser Filter Enabled property set to true is helpful to you.

Specifying the Enabled status equal to the True query in the Get-AdUser Filter parameter is much more efficient as it sends the filters to AD to get adusers having enabled equal to true.

However, if you use Get-AdUser -Filter * | Where … gets all the users from the active directory and passes it to the where condition to check that the enabled status is equal to true.

Cool Tip: How to get aduser excluding disabled accounts in PowerShell!

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.