Error 403 when running GAM line to delete users

715 views
Skip to first unread message

Chris Ericson

unread,
Sep 23, 2013, 11:21:43 AM9/23/13
to google-ap...@googlegroups.com
When using the command line to delete users in a .csv or .txt file, It runs correct, but it errors out for each user:

Error 403: Not Authorized to access this resource/api - forbidden.

API is enabled; 

GAM line:   FOR /F %A IN (classof2013.csv) DO gam.exe delete user %A

Jay Lee

unread,
Sep 23, 2013, 11:42:44 AM9/23/13
to google-ap...@googlegroups.com
Are you specifying the user's full email address in the text file?


Regards,

Jay Lee
Large Customer Deployment Lead   |  Dito


--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/db02e03a-15a4-4f03-965a-8e5c5a074f68%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Chris Ericson

unread,
Sep 23, 2013, 12:01:24 PM9/23/13
to google-ap...@googlegroups.com
Yes. 

Do I need to delete the other columns of info? FN, LN, LastLogin, FirstLogin, Quota?


On Monday, September 23, 2013 10:42:44 AM UTC-5, Jay Lee wrote:
Are you specifying the user's full email address in the text file?


Regards,

Jay Lee
Large Customer Deployment Lead   |  Dito


On Mon, Sep 23, 2013 at 11:21 AM, Chris Ericson <chris....@yorkdukes.org> wrote:
When using the command line to delete users in a .csv or .txt file, It runs correct, but it errors out for each user:

Error 403: Not Authorized to access this resource/api - forbidden.

API is enabled; 

GAM line:   FOR /F %A IN (classof2013.csv) DO gam.exe delete user %A

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.

Chris Ericson

unread,
Sep 23, 2013, 12:44:28 PM9/23/13
to google-ap...@googlegroups.com
I figured it out. Ran the gam info domain command first

Jason Miller

unread,
Oct 1, 2013, 11:28:57 AM10/1/13
to google-ap...@googlegroups.com
Hi Chris, what is that command line you are referring to? I'm looking to do this exact thing, delete multiple users at once using a csv file. 

Thanks!!

drreid

unread,
Oct 11, 2013, 9:18:03 AM10/11/13
to google-ap...@googlegroups.com
Hey Jason,

I've been using the linux command line below to bulk add members to a group from a csv file. Also, I added the gam install dir to my path.

xargs -a qryAllActivePastorEmail.csv -I % gam.py update group <group email address> add member %

Hope This Helps,

Brandon U.

unread,
Oct 11, 2013, 10:41:18 AM10/11/13
to google-ap...@googlegroups.com
I use PowerShell at my organization and use the following:

Param(
    [parameter(Mandatory=$true)]
    [alias("f")]
    $file)

$list = Import-Csv $file
foreach($entry in $list) {
    .\gam.exe delete user "$($entry.username)"
  }

I have this saved as "delete_users.ps1" and I run it through powershell like the following: .\delete_users.ps1 users.csv
Reply all
Reply to author
Forward
0 new messages