Suspend account 45 days after created if not used

80 views
Skip to first unread message

Bryan Guidroz

unread,
Jun 21, 2017, 2:02:36 PM6/21/17
to GAM for G Suite
Any suggestions on a way to suspend a user account 45 days after it was created?  Ideally per ou.
So, if users in /Site1/Group1 haven't logged in 45 days after their account was created, I want to suspend the account.

Message has been deleted

+KimNilsson

unread,
Jun 26, 2017, 6:10:02 AM6/26/17
to GAM for G Suite
With creationtime being a field you can find, you can push it through some pipes to find those that haven't used their accounts.
You will have to figure out the part that counts back 45 days from today, though. (That's the bold italicised part.) :-)

gam print users fields lastlogintime,creationtime query 'OrgUnitPath=/Site1/Group1' | grep ',Never,2017-05-12' | awk -F, '{print $1}' | gamx csv - fields Inactive gam update user ~Inactive suspended on | tee -a These.users.have.been.deleted.20170626-1141

I have used this with | grep ',Never,2017-05-' | to find users created "last" month and that haven't ever logged in.
Reply all
Reply to author
Forward
0 new messages