mass deleting user accounts with GAM

4,713 views
Skip to first unread message

skeeler

unread,
Dec 9, 2010, 3:19:16 PM12/9/10
to Google Apps Manager
Hi all,

I have a need to delete about 700 user accounts but I will need to
recreate them again (test environment). I know the syntax to delete
one user: gam delete user xyz

All my user accounts start with the number 15 (example: 15smithr) is
there a way to mass execute the delete command other that creating a
batch file and repeating the command string for each user name.

Thanks
S.Keeler

Oliver Hartley

unread,
Dec 9, 2010, 3:26:54 PM12/9/10
to google-ap...@googlegroups.com
yes

this is what i do....

i create a csv file in excel or google spreadsheets with the 700 lines

once i'm done i open a cmd
gam info domain
put the credencials
when done
copy the 700 lines and paste it on the cmd


Oliver Hartley Lyon | CTO | Tel: +562-640-3900 | Cel: +569-9162-7029








--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to
google-ap...@googlegroups.com
To unsubscribe from this group, send email to
google-apps-man...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/google-apps-manager

Jay Lee

unread,
Dec 9, 2010, 3:29:56 PM12/9/10
to google-ap...@googlegroups.com
What Oliver said but you can also use:

gam print users

to get a list of all users in the domain. Then clean that up in Excel.

Jay
--
Jay Lee | Senior Network / System Administrator
Philadelphia Biblical University
200 Manor Ave | Langhorne, PA 19047-2990

tsihh

unread,
Dec 9, 2010, 3:38:34 PM12/9/10
to Google Apps Manager
I would mix it a little different way. First part i would do like Jay
wrote

On Dec 9, 9:29 pm, Jay Lee <j...@pbu.edu> wrote:
> gam print users
>
> to get a list of all users in the domain. Then clean that up in Excel.

One note though, i would use .txt not .csv extension

Next i would use find-replace feature to generate a full command to
each line. Smth like this:
c:\<address_to_your_gam_directory\gam.exe delete user xyz

Now the only things left to do is to rename the txt extension to bat/
cmd and execute it

Rgds,
Ahti

chrisj

unread,
Dec 11, 2010, 11:14:32 PM12/11/10
to Google Apps Manager
Check out the Windows PowerShell scripting capabilities for looping
too. You can loop through the list of email addresses in the csv
file.

There is a useful example here: http://code.google.com/p/google-apps-manager/wiki/BulkOperations
Reply all
Reply to author
Forward
0 new messages