Using Dito Google Apps Manager (GAM), you can set up a schedule to automatically perform a task on a recurring timeframe, and send a copy of the log to be stored in Google Drive. This can really be helpful when you need to run the same script every hour/day/week etc.
In this blog post, we will provide instructions and a sample script for setting up a daily log schedule using Dito GAM. We will be using a command that would draw a 2-factor verification user status report, and send the report to Google Drive. The script and command can be adjusted to draw other Admin reports, such as Audit logs and User behavior reports. You could run any GAM command this way, with any number of commands (create each one separately).
Note: These instructions are written under the assumption that GAM is already installed and set up for your domain. If this is not the case, please visit the GAM Wiki page and follow the Getting Started instructions.
The first thing you will need to do is create a batch file containing the script you would like to run. We would advise storing this in your GAM folder. To create a batch file, open a notepad document and enter the script as follows (you may need to tweak the command to suit your environment if your GAM folder is not located at c:gam):
Next, click the File menu and select Save as. When prompted, save this file to your GAM folder as “filename.bat.” In this example, we named it “2factor.bat.”
Now you need to set a command that will run this command daily, so open your command prompt. Here is an example of what the script you are going to use will look like:
This creates a daily schedule to look at 2factor.bat every day. Running this command will start the timer immediately and continue every day at the same time until the task is deleted. Note: There are more exact parameters available, and you can view a list here.