Group sync from powershell object

25 views
Skip to first unread message

Aaron Smith

unread,
Jul 22, 2024, 4:26:07 PM (5 days ago) Jul 22
to GAM for Google Workspace
I am pulling a list of email addresses from a 3rd party system into Powershell using the RESTApi. This is a group inside of the 3rd party system and I want to keep a Google Group in sync with that group.

Since I can already get these email addresses into powershell as an object is there a way i can simply pass that object into the "gam update group <group email> sync members" command?

I would much rather keep this inside of the script as opposed to exporting the list as a CSV and then redirecting the csv back into the gam command. 

Any ideas would be much appreciated!
Thanks

Ross Scroggs

unread,
Jul 22, 2024, 5:37:00 PM (5 days ago) Jul 22
to google-ap...@googlegroups.com
With Advanced GAM you can say:
gam update group <group email> sync members users a,b,c
or
gam update group <group email> sync members users "a b c"

Can you expand the PowerShell object on the command line to produce a list in either form?

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/8a65de50-4dd5-4e46-b1b2-566faec4a0e7n%40googlegroups.com.

Aaron Smith

unread,
Jul 23, 2024, 8:42:13 AM (4 days ago) Jul 23
to GAM for Google Workspace
Fantastic! Thank you for your quick reply! This is exactly what I needed.

I flattened the object into a comma separated string using the following powershell command
$flatEmail = $response.email -join ","
Reply all
Reply to author
Forward
0 new messages