Find and Move Suspended Users

168 views
Skip to first unread message

Elijah Gladwell

unread,
Sep 23, 2024, 10:48:05 AM9/23/24
to GAM for Google Workspace
Hello,

I'm wondering if there is a way in GAM to:

1. Export a CSV of all suspended users 
(I know this can be done from the admin console but it would be nice to do it in the same bat file as the next step)

2. Move each user on that list to our "suspended accounts" OU

Thank you for your help! 

Ross Scroggs

unread,
Sep 23, 2024, 10:56:54 AM9/23/24
to google-ap...@googlegroups.com
You can do this is in a single step:

gam redirect stdout ./MoveSuspendedUsers.txt redirect stderr stdout update users query "isSuspended=True" ou "'Suspended Accounts"

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/2a031223-f105-4cd1-8c33-f42cce61c28an%40googlegroups.com.

Ross Scroggs

unread,
Sep 23, 2024, 11:07:47 AM9/23/24
to google-ap...@googlegroups.com
Fix typo:
gam redirect stdout ./MoveSuspendedUsers.txt redirect stderr stdout update users query "isSuspended=True" ou "/Suspended Accounts"

Ross
----
Ross Scroggs


Elijah Gladwell

unread,
Sep 23, 2024, 12:05:26 PM9/23/24
to GAM for Google Workspace
Worked like a charm! 

Would it also be possible to delete any user that was suspended more than 2 years ago? 

Ross Scroggs

unread,
Sep 23, 2024, 12:21:44 PM9/23/24
to google-ap...@googlegroups.com

gam config csv_output_row_filter "accounts.disabled_time:date<-2y" redirect csv ./DisabledOver2YearsAgo.csv report users fields accounts:is_suspended,accounts:disabled,accounts:disabled_reason ou "/Suspended Accounts"


These users may have files that they shared that are still in use, simply deleting them is before versify there sharing is probably not a good idea.


Ross

----
Ross Scroggs


Elijah Gladwell

unread,
Sep 25, 2024, 10:39:00 AM9/25/24
to GAM for Google Workspace
Hey that works perfectly for our use case! 👍

One more piece, is there a way to remove assigned licenses (i.e. Google Workspace for Education Plus) from all suspended users?

Reply all
Reply to author
Forward
0 new messages