Orchestrator Functions: Active Directory Field Functions – Base – AD Group – 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: ADGroupGetAttribute

privateADGroupGetAttribute<T>(objADGroup:AD_Group,strADGroupAttributeName:string):T{

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

letanyADGroupAttribute:T=objADGroup.getAttribute(strADGroupAttributeName)asT;

returnanyADGroupAttribute;
}

Private Function: ADGroupSetAttribute

privateADGroupSetAttribute<T>(objADGroup:AD_Group,strADGroupAttributeName:string,anyADGroupAttributeValue:T):boolean{

this.objLogger.info(`Setting AD User Group Attribute '${strADGroupAttributeName}' with value '${anyADGroupAttributeValue.toString()}'.`);

try{
objADGroup.setAttribute(strADGroupAttributeName,anyADGroupAttributeValueasany);

returntrue;
}
catch (objException){
//@ts-ignore
this.objLogger.error(`Failed to set attribute '${strADGroupAttributeName}=${anyADGroupAttributeValue.toString()}' for User Group${objADGroup.name}\n\t${objException}`);

returnfalse;
}
}

Private Function: ADGroupAddAttribute

privateADGroupAddAttribute<T>(objADGroup:AD_Group,strADGroupAttributeName:string,anyADGroupAttributeValue:T):boolean{

this.objLogger.info(`Adding AD User Group Attribute '${strADGroupAttributeName}' with value '${anyADGroupAttributeValue.toString()}'.`);

try{
//@ts-ignore
objADGroup.addAttribute(strADGroupAttributeName,anyADGroupAttributeValue);

returntrue;
}
catch (objException){
//@ts-ignore
this.objLogger.error(`Failed to add attribute '${strADGroupAttributeName}=${anyADGroupAttributeValue.toString()}' for User Group${objADGroup.name}\n\t${objException}`);

returnfalse;
}
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like