Src/Private/Tools/Get-ADObjectSearch.ps1

function Get-ADObjectSearch {
    <#
    .SYNOPSIS
    Used by As Built Report to lookup Object subtree in Active Directory.
    .DESCRIPTION
 
    .NOTES
        Version: 0.1.0
        Author: Jonathan Colon
 
    .EXAMPLE
 
    .LINK
 
    #>

    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [ValidateNotNullOrEmpty()]
        $DN,
        $Session,
        $Filter,
        $Properties = '*',
        $SelectPrty

    )
    $ADObject = [System.Collections.Generic.List[object]]::new()
    foreach ($Object in $DN) {
        $ADObject.Add((Invoke-CommandWithTimeout -Session $Session -ScriptBlock { Get-ADObject -SearchBase $using:DN -SearchScope OneLevel -Filter $using:Filter -Properties $using:Properties -EA 0 | Select-Object $using:SelectPrty }))
    }
    $ADObject;
}# end