GAM in a Task Scheduler

345 views
Skip to first unread message

Scott Fitzhugh

unread,
Apr 14, 2022, 9:34:48 AM4/14/22
to GAM for Google Workspace
I've been trying to run a powershell script with GAM commands in it via the Task Scheduler on a Windows 2019 server.  It says it is running but it never finishes.

If I try to run the script (or any GAM command) I have to open Powershell as an Administrator - then it runs fine.

I use a user to run script that is in the local Administrator's group.  I have also set the task to use the following settings:
- Run whether user is logged in or not
- Run with Highest privileges

I have tried changing the option 'Configure for' from 'Windows Vista,Windows Server 2008' to 'Windows Server 2019'  and also to 'Windows 7,Window Server 2008 R2', all with no effect.

Has anyone tried this or something similar that worked?

Adam Strugatch

unread,
Apr 14, 2022, 3:22:41 PM4/14/22
to GAM for Google Workspace
You mentioned it is a PowerShell script. Is it signed? What is your execution policy? Honestly most of the scripts I have for GAM are simple enough that I stick with batch out of sheer laziness.

Does you script generate a log? If it does, is there any indication of where it stops? 

Ross Scroggs

unread,
Apr 14, 2022, 3:25:46 PM4/14/22
to google-ap...@googlegroups.com
Scott,

Contact me directly via Meet/Zoom and I'll help figure out what's going on.

--
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/aab07253-9d84-43e4-be24-68990eb46e55n%40googlegroups.com.

Unhappy Buckaroo

unread,
Apr 20, 2022, 2:34:57 PM4/20/22
to GAM for Google Workspace
Hi Scott:
We started doing something similar in February (thanks Ross!): our student information system does a nightly export of all currently enrolled students, and we use a python script to convert that to a csv file with the fields we need to update our student email accounts with GAM; finally, gam executes a batch file to update the accounts.
The author of the task is the account we use to run GAM on that server, and it's set to run whether the user is loggin on or not; "Run with highest privileges" is not checked.
The task scheduler Action is "Start a program", the Program/script: is the full unc path to the gam executable, Add arguments (optional): is the command we want to run (tbatch file.bat) and the Start in (optional):  is the folder where gam is installed.
It was a right PITA to get working, but in another 6 months it should have paid off the investment in time it took to get going.
If you need any more details, let me know.

Cheryl Kiras

unread,
Feb 23, 2024, 3:18:48 PM2/23/24
to GAM for Google Workspace
I am trying to accomplish the same thing.   Working through it now.  A bit frustrating to run with task scheduler.
Need it to run after the schedule GCDS runs.

Reply all
Reply to author
Forward
0 new messages