Function: Active Directory Object Base Functions – Search

by Simon Sparks · 4 February 2026

To use this function add it to the class library file named OrchestratorPluginADService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: OrchestratorPluginADService.ts

Private Function: ADObjectGetEntry

private ADObjectGetEntry<T>(strBaseDN: string, arrAttribute: string[]): T {
    //@ts-ignore
    let objADObject: T = ActiveDirectory.getEntry(strBaseDN, arrAttribute, this.objADHost) as T;

    return objADObject;
}

Private Function: ADObjectSearch

private ADObjectSearch<T>(strObjectType: string, strQuery: string): T[] {
    let arrADObject: T[] = ActiveDirectory.search(strObjectType, strQuery, this.objADHost) as T[];

    return arrADObject;
}

Private Function: ADObjectSearchExactMatch

private ADObjectSearchExactMatch<T>(strObjectType: string, strObjectName: string, intLimit: number = 1): T {
    let arrADObject: T[] = ActiveDirectory.searchExactMatch(strObjectType, strObjectName, intLimit, this.objADHost) as T[];

    let objADObject: T = arrADObject[0];

    return objADObject;
}

Private Function: ADObjectSearchRecursively

private ADObjectSearchRecursively<T>(strObjectType: string, strQuery: string): T[] {
    //@ts-ignore
    let arrADObject: T[] = ActiveDirectory.searchRecursively(strObjectType, strQuery, this.objADHost) as T[];

    return arrADObject;
}

Private Function: ADObjectSearchForEntry

private ADObjectSearchForEntry<T>(strBaseDN: string, strObjectName: string, strFilter: string, arrAttribute: string[]): T {
    //@ts-ignore
    let objADObject: T = ActiveDirectory.searchForEntry(strBaseDN, LdapSearchScope.SUB, 5, strFilter, arrAttribute, this.objADHost) as T;

    return objADObject;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like