Dump group membership
Code Block |
---|
var groupName = 'CTS STC Cluster Zone 1'; var gr = new GlideRecord('sys_user_group'); gr.addQuery('name', 'CTS STC Cluster Zone 1'); gr.query();gr.next(); var gr_sysid = gr.sys_id; var g = new GlideRecord('sys_user_grmember'); g.addQuery('group', gr_sysid); g.query(); var n=0; while (g.next()) { if (n == 0 ) { gs.print('members are: '); } gs.print(g.user.user_name + ';'); n++; } gs.print(n + " members in group"); |
Now parse it into something useful for going back into AD
Code Block |
---|
*** Script: members are: *** Script: jfo8; *** Script: dkb23; *** Script: fc265; *** Script: ak764; *** Script: yx97; *** Script: dlp54; *** Script: djy6; *** Script: gmh29; *** Script: mdw55; *** Script: bmm44; *** Script: ncx2; *** Script: xn6; *** Script: jt487; *** Script: blr33; *** Script: rc527; *** Script: jcw84; *** Script: bmw32; *** Script: dam78; *** Script: dcj23; *** Script: lab224; *** Script: jww39; *** Script: jkt24; *** Script: ay222; *** Script: jl2377; *** Script: jlf8; *** Script: xy63; *** Script: mg828; *** Script: cap32; *** Script: dsf3; *** Script: yw355; *** Script: ooo9; *** Script: csw3; *** Script: ak; *** Script: yb45; *** Script: sbo2; *** Script: dz65; *** Script: rrm3; *** Script: 37 members in group |