Can you add users to Groups with script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2009 11:50 AM
We are working on addings users to groups based on a field we have for their region. For example all users in the Asia region would be added to the Asia Users group. I haven't seen a way to do this through the ui by picking the group and adding all users that meet the criteria to the group. I know it could be done via the list collector but it limits you to 100 people at a time and when dealing with 8k users its difficult. Because roles/groups are handled differently ie I can't filter from a list view and then update all with the information it would be nice if someone had a similar script to add mass users to groups/roles.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2021 05:54 AM
var groups = workflow.scratchpad.groups.toString().split(',');
//gs.log(groups.length);
for (var i = 0; i < groups.length; i++){
var gr = new GlideRecord ('sys_user_grmember');
gr.initialize();
gr.group = groups[i];
gr.user = current.variables.name.sys_id;
gr.insert();
}