ERROR: 400: Mail service not enabled - serviceNotAvailable

1,806 views
Skip to first unread message

Andrew Marks

unread,
Sep 10, 2021, 12:57:23 PM9/10/21
to GAM for Google Workspace

I am being tasked to assist my old team  with getting information on forwarding

$ gam all users print forwardingaddress todrive

Getting all Users in Google Workspace account (may take some time on a large account)...

Got 21476 Users...

done getting 21476 Users.

ERROR: 400: Mail service not enabled - serviceNotAvailable

So I ran this command on myself and it is able to send a sheet to drive

PROD [amarks@ausc-toolbox1 ~]$ gam user amarks print forwardingaddress todrive

Drive file uploaded to:

 https://docs.google.com/spreadsheets/d/1Q-HXS1JbM3Y5D6yH1xxxxxxxxxxxxxxxxxxxx/edit?usp=drivesdk

So i checked my service account and all is well (note I rotated my key since it wasnot used for a long time)  What am i missing here? 

PROD [amarks@toolbox1 ~]$  gam user amarks check serviceaccount

Computer clock status:

 Your system time differs from admin.googleapis.com by less than 1 second   PASS

Service Account Private Key Authentication:

 Authenticating...                                                          PASS

Checking key age. Google recommends rotating keys on a routine basis...

 Key is 0 days old                                                          PASS

Domain-Wide Delegation authentication as ama...@indeed.com:

 https://mail.google.com/                                                   PASS

 https://www.googleapis.com/auth/apps.alerts                                PASS

 https://www.googleapis.com/auth/calendar                                   PASS

 https://www.googleapis.com/auth/cloud-identity                             PASS

 https://www.googleapis.com/auth/drive                                      PASS

 https://www.googleapis.com/auth/drive.activity                             PASS

 https://www.googleapis.com/auth/gmail.settings.basic                       PASS

 https://www.googleapis.com/auth/gmail.settings.sharing                     PASS

 https://www.googleapis.com/auth/spreadsheets                               PASS


All scopes passed!

Service account xxxxxxxxxx is fully authorized.


Andrew Marks

unread,
Sep 10, 2021, 1:36:53 PM9/10/21
to GAM for Google Workspace
Doh, I think this means the mail service is not enabled for a user if i am understanding the email threads I found.

Ross Scroggs

unread,
Sep 10, 2021, 2:26:49 PM9/10/21
to google-ap...@googlegroups.com
Andrew,

You're correct; unfortunately Basic GAM bails on the error. Advanced GAM will proceed.

Ross

--
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/9d660614-99b5-479d-8412-1dd794c664d6n%40googlegroups.com.


--

Andrew Marks

unread,
Sep 10, 2021, 4:13:26 PM9/10/21
to GAM for Google Workspace
Ross, What command should I run with Advanced GAM?

Ross Scroggs

unread,
Sep 10, 2021, 4:24:37 PM9/10/21
to google-ap...@googlegroups.com
Andrew,

The same command will work: gam all users print forwardingaddress todrive

You can speed it up by introducing parallel processing

gam config auto_batch_min 1 redirect csv - multiprocess todrive all users print forwardingaddress

Ross



--

Andrew Marks

unread,
Sep 13, 2021, 1:30:09 PM9/13/21
to GAM for Google Workspace
@Ross thanks again for the info 

I ran this command and 

gam config auto_batch_min 1 redirect csv - multiprocess todrive all users print forwardingaddress

It went through all of the users and generated the following for each user in nohup.out

ie 

User: ama...@indeed.com, Service not applicable/Does not exist, I have two forwards I set up as a test.

Do I have a missing scope? 

Ross Scroggs

unread,
Sep 13, 2021, 1:33:39 PM9/13/21
to google-ap...@googlegroups.com
Andrew,

Send me a Meet/Zoom invitation

Ross



--

Ross Scroggs

unread,
Sep 13, 2021, 1:37:05 PM9/13/21
to google-ap...@googlegroups.com
Andrew,

What does this show:
gam user marks show gmailprofile

Verify your service account authorization
gam user amarks  check serviceaccount

Ross



--

Andrew Marks

unread,
Sep 14, 2021, 5:12:19 PM9/14/21
to GAM for Google Workspace

Ross, thanks again for your help.. Is it possible run a report with the users OU and the email filter with the forwarding address?

Ross Scroggs

unread,
Sep 14, 2021, 5:19:47 PM9/14/21
to google-ap...@googlegroups.com
Andrew,

You can do either of these based on your OUs.
gam config auto_batch_min 1 redirect csv - multiprocess todrive ou "/Path/To/OU" print forwardingaddress
gam config auto_batch_min 1 redirect csv - multiprocess todrive ou_and_children "/Path/To/OU" print forwardingaddress

Is this what you're after?

Ross

Andrew Marks

unread,
Sep 14, 2021, 5:27:22 PM9/14/21
to google-ap...@googlegroups.com
Thats close, I am being asked by security if I can provide any additional visibility into the rule that is set up for the forward.

Andrew Marks
Internal: x77761
Indeed How the World Works.™


Ross Scroggs

unread,
Sep 14, 2021, 5:31:59 PM9/14/21
to google-ap...@googlegroups.com
Andrew,

gam config auto_batch_min 1 redirect csv - multiprocess todrive ou "/Path/To/OU" print filter
gam config auto_batch_min 1 redirect csv - multiprocess todrive ou_and_children "/Path/To/OU" print filter

Ross




--

Andrew Marks

unread,
Sep 14, 2021, 5:42:32 PM9/14/21
to google-ap...@googlegroups.com
Thanks, i will give these a shot.

Andrew Marks
Internal: x77761
Indeed How the World Works.™

Reply all
Reply to author
Forward
0 new messages