Skip to content

Enabled user filter in Get-DomainUsers function is incorrect #4

@mvz00

Description

@mvz00

Error in the Get-DomainUsers function. Filtering on enabled and disabled users but returning a statement saying "Enabled users with XX"

[array]$DomainUsers = Get-ADUser -Filter * -Property $ADLimitedProperties -Server $DomainDC [array]$DomainEnabledUsers = $DomainUsers | Where {$_.Enabled -eq $True } [array]$DomainUsersWithReversibleEncryptionPasswordArray = **$DomainUsers** | Where { $_.UserAccountControl -band 0x0080 }

Should be:

[array]$DomainUsers = Get-ADUser -Filter * -Property $ADLimitedProperties -Server $DomainDC [array]$DomainEnabledUsers = $DomainUsers | Where {$_.Enabled -eq $True } [array]$DomainUsersWithReversibleEncryptionPasswordArray = **$DomainEnabledUsers** | Where { $_.UserAccountControl -band 0x0080 }

Issue is that it is returning properties of all enabled and disabled users where the Write-Host statement says it is filtered on Enabled users only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions