The code worked great! How would I manipulate the code to check group member of a group?

ex.

group1
group2
group3

group2 and group3 are members of group1

a script is assigned to group1.

how do I check if the script will work on a machine in group2 or group3?

By the Way, Thanks Howard Bullock.