Public/Get-ADUserList.ps1
Function Get-ADUserList { [CmdletBinding()] param ( [Parameter()] [array] $SearchData, $Filters = @("employeeid", "samaccountname", "distinguishedName", "mail", "name") ) $Results = @() Foreach ($Filter in $Filters) { Write-Verbose "Running Search on $Filter Filter" $SearchFilter = $SearchData -join ")($Filter=" $SearchFilter = "(|($Filter=$SearchFilter))" Write-Debug $SearchFilter $Results += Get-ADUser -LDAPFilter $SearchFilter } $Results = $Results | Sort-Object -Unique Return $Results } |