Orchestrator Functions: Active Directory Field Functions – Base – AD User – Get, Set and Add

by Simon Sparks · 5 January 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: ADUserAttributeGet

privateADUserAttributeGet<T>(objADUser:AD_User,strADUserAttributeName:string):T{

this.objLogger.info(`Getting AD User Attribute '${strADUserAttributeName}'.`);

letanyADUserAttribute:T=objADUser.getAttribute(strADUserAttributeName)asT;

returnanyADUserAttribute;
}

Private Function: ADUserAttributeSet

privateADUserAttributeSet<T>(objADUser:AD_User,strADUserAttributeName:string,anyADUserAttributeValue:T):boolean{

this.objLogger.info(`Setting AD User Attribute '${strADUserAttributeName}' with value '${anyADUserAttributeValue.toString()}'.`);

try{
//@ts-ignore
objADUser.setAttribute(strADUserAttributeName,anyADUserAttributeValue);

returntrue;
}
catch{
returnfalse;
}
}

Private Function: ADUserAttributeAdd

privateADUserAttributeAdd<T>(objADUser:AD_User,strADUserAttributeName:string,anyADUserAttributeValue:T):boolean{

this.objLogger.info(`Adding AD User Attribute '${strADUserAttributeName}' with value '${anyADUserAttributeValue.toString()}'.`);

try{
//@ts-ignore
objADUser.addAttribute(strADUserAttributeName,anyADUserAttributeValue);

returntrue;
}
catch{
returnfalse;
}
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like