Home » PowerShell » Get Aduser Exclude Disabled Accounts in PowerShell

Get Aduser Exclude Disabled Accounts in PowerShell

To get ad users to exclude disabled accounts from Active Directory, use the Get-AdUser cmdlet in PowerShell. The Get-AdUser command has an Enabled property that indicates whether the user is enabled or disabled.

The Enabled property having a True value indicates that the user is enabled and the False value represents the user who is disabled in the active directory.

The following PowerShell script gets active directory users excluding the disabled users.

Get-ADUser -filter 'enabled -eq "true"' | Select Name, Enabled

In the above PowerShell script, the Get-AdUser command uses the Filter parameter to specify the criteria to search for the user having ‘enabled -eq “true”‘, which means retrieving only users having Enabled status as True and pipes the result to the Select command to display the Name and Enabled property.

The output of the above PowerShell script command retrieves the aduser exclude disabled status from the Active Directory. The Get-AdUser command returns the users along with their Name and Enabled status as True.

Get Aduser Exclude Disabled in PowerShell
Get Aduser Exclude Disabled Accounts in PowerShell

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

Conclusion

I hope the above article on how to get aduser to exclude disabled accounts using the Get-AdUser command in PowerShell is helpful to you.

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