I tried to use Powershell to audit disabled AD user accounts but the results I get do not match what is shown in GUI through Active Directory Users and Computers
.
DC is Windows server 2012R2
and Powershell version 4.0
.
This lists only few of the users that are marked as disabled in GUI:
Get-ADUser -Filter 'enabled -eq $false' |Select-Object -Property Samaccountname
This lists the same users as previous command:
Search-ADAccount -AccountDisabled |Select-Object |FT SamaccountName,ObjectClass
This lists many users that are marked as disabled in GUI:
Get-ADUser -Filter 'enabled -eq $true' |Select-Object -Property Samaccountname
The user accounts have been disabled in following way:
In Directory Users and Computers
right clicking the user object and selecting Disable account
.
Powershell commands where issued on same DC where the accounts where disabled using GUI. There has been several days between accounts gettings disabled and the Powershell commands getting issued.
Is there issue with Powershell commmands I am using or does disabled
mean different things is GUI and Powershell?