taers232c / gamadv-xtd3 Goto Github PK
View Code? Open in Web Editor NEWCommand line tool to manage Google Workspace
Command line tool to manage Google Workspace
ERROR: Expecting value: line 1 column 1 (char 0)
When I run a command such as typed below:
gam user [email protected] print filelist others_folders
I get the following output:
Getting all Drive Files/Folders that match query (not 'me' in owners and mimeType = 'application/vnd.google-apps.folder') for [email protected] Got 1 Drive File/Folder that matched query (not 'me' in owners and mimeType = 'application/vnd.google-apps.folder') for [email protected]... Owner,name,webViewLink
I would expect to see data under the "Owner,name,webViewLink"
Traceback (most recent call last):
File "gam.py", line 40960, in ProcessGAMCommand
File "gam.py", line 22167, in doCreateUser
File "gam.py", line 8285, in sendCreateUpdateUserNotification
KeyError: 'primaryEmail'
After the 4.88.04 update - this is the error message
Hi
It seems there is an issue when I try to update custom schema data when users email address is longer than 64 characters
Can you check and let me know
Thanks
In Advanced GAM, progress indicator is diplayed in the same line, changing as more users are downloaded. However, since email addresses have different lengths, after several updates, the status line shows relicts from previous updates like this:
gam print users
Getting all Users, may take some time on a large G Suite Account...
Got 6500 Users: [email protected] - [email protected]mple.com
To fix: it's necessary to print a special terminal control sequence "clear to end of line" after each progress update. This sequence is defined by tput el
.
Hi, Hope someone can help?
After creating a new GAM project and then running GAM oauth create, i click the allow api access button and then get a Authorization error invalid request account restricted. i've attached a screen shoot of the error.
i manage a number of domains, some have authorised without problems and some get the above error..i'm a little lost. it seems google has changed API permissions recently and i'm wondering whether this has anything to do with it.
Python 3.7.1 64-bit final (on Mac):
I get these warnings on all commands:
gam.py:2303: DeprecationWarning: 'U' mode is deprecated
with open(fileName, u'rU') as f:
gam.py:2304: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
config.readfp(f)
It seems to work fine if I change to this:
2303 with open(fileName, u'r') as f:
2304 config.read_file(f)
/Mattias
I am trying to find and take ownership of a document.
Here is the command I use to find the document id...
gam user [email protected] show fileinfo query "name contains 'End of School Checkout List'" fields id,title
Here is the result:
Getting all Drive Files/Folders that match query (name contains 'End of School C heckout List') for [email protected] Got 1 Drive File/Folder for [email protected]... User: [email protected], Show 1 Drive File/Folder Drive File: End of School Checkout List (1JbT7g2MgOMEmJSw5amU_KpSugQe5ScRGG4cY UrZqoPs) id: 1JbT7g2MgOMEmJSw5amU_KpSugQe5ScRGG4cYUrZqoPs name: End of School Checkout List
I then run this:
gam user [email protected] create drivefileacl 1JbT7g2MgOMEmJSw5amU_KpSugQe5ScRGG4cYUrZqoPs user [email protected] role owner
and I get this.....
User: [email protected], Create 1 Drive File/Folder ACL User: [email protected], Drive File/Folder ID: 1JbT7g2MgOMEmJSw5 amU_KpSugQe5ScRGG4cYUrZqoPs, Create Failed: Permission ID: [email protected] Sorry, you do not have permission to share.
Any idea why I cant take ownership?
When running, e.g., gam print group-members group [email protected] recursive
, the following error message is now received:
Getting all Members, Managers, Owners for [email protected]
Traceback (most recent call last):
File "gam.py", line 43455, in ProcessGAMCommand
File "gam.py", line 17743, in doPrintGroupMembers
File "gam.py", line 5176, in MoveTitlesToEnd
ValueError: list.remove(x): x not in list
Expected behavior is a printed list of all members in the group (recursively).
This seems to be caused by e9e43e7#diff-f5ee7a4a2256c192bffeb8eaa0da15eeR5181
I had to follow the instructions here to enable Google Cloud for my organization
Maybe you could add this info to the documentation ?
I would be happy to write it but could not find the right place in the documentation which is quite dense !
Thanks for the hard work !
Hi Ross,
Thanks again for all your work on this script, it's appreciated globally!
I'm seeing an issue on Windows devices (presume all but Windows 10 Pro v1909 here) when running multiprocess commands on large amount of users.
GAMADV-XTD3 4.99.25 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs [email protected]
Python 3.8.1 64-bit final
google-api-python-client 1.7.11
httplib2 0.16.0
oauth2client 4.1.3
Windows 10 10.0.18362 AMD64
gam config redirect csv ./tokenslist.csv multiprocess csv userlist.csv gam user print tokens
(didnt auto_batch_min this)
When it gets up to 49K users the tool will get stuck in a loop:
ERROR: File: C:\Users\user.gam\oauth2.txt, [Errno 24] Too many open files: 'C:\Users\user\.gam\oauth2.txt.lock'
This will happen multiple times and then it will just repeat the vague
ERROR: [Errno 24] Too many open files
ERROR: [Errno 24] Too many open files
again and again etc.
Doesnt happen on ubuntu
Can reproduce if needed for extra debug logs, just takes a while :) Be great to solve this if you can!
Thanks
Damion
gam.py:2417: DeprecationWarning: This method will be removed in future versions. Use 'parser.read_file()' instead.
config.readfp(f)
Kudos on extending Gam to handle this very useful feature. We have 615 domain shared contacts imported by a consultant 3 years ago that I can list using "gam info contacts". I've read through the docs but could not make any headway in deleting those and importing a fresh list. Hoping some can provide "simple" instructions to:
Any help would be deeply appreciated. Thanks!
When trying to sync guardians, I recieve the following error;
"Traceback (most recent call last):
File "gam.py", line 41763, in ProcessGAMCommand
File "gam.py", line 4747, in getEntityToModify
File "gam.py", line 4573, in getEntitiesFromCSVbyField
File "gam.py", line 2324, in openCSVFileReader
File "csv.py", line 98, in fieldnames
_csv.Error: line contains NULL byte"
This was running fine back in May, when I ran some test scripts. I have even tried using the same CSV I used back in May, but get the same result.
Gamx should be able to add new fields to schemas. I'm currently getting 'does not exist'. Verified that the same command on the same schema w/ same values works for jay's 'gam' command:
$ gamx version
GAM 4.86.03 - https://github.com/taers232c/GAMADV-XTD3
$ gamx update schema Entitlements field foocloud indexed type bool endfield
Schema: Entitlements, Update Failed: Does not exist
$ gam version
GAM 4.40 - https://git.io/gam
$ gam update schema Entitlements field foocloud indexed type bool endfield
Updated user schema Entitlements
Hi
I use a filter to get all chrome licences on my Admin console and it seems there is a bug because now when I check my OU I can see a new sub Org Called "temp-delete-me"
"D:\GAM Global\gam.exe" select admin_export redirect csv D:\0-OUT\ChromeOS\ou_chrome_devices.csv multiprocess csv D:\0-OUT\ChromeOs\out.csv gam print org fromparent "~OU Gsuite" mincroscount 1 fields orgUnitPath,name showparent toplevelonly batchsuborgs False
Thanks
Hi, please lmk if where I should post this if this is not the correct place for this question...
is there a way to bulk toggle all files marked as "Restricted" off and on?
i see 'restricted' flags and labels here, https://github.com/taers232c/GAMADV-XTD3/wiki/Users-Drive-Files
but i can't seem to crack the syntax to make it spit out something that makes sense.
We ask bc these restricted files are a hard block on our migration project from GoogleDrive to O365-OneDrive.
Hey Ross,
Would like to implement a nicer sendemail that uses the display name of the user, rather than just the e-mail address for the "From" field. Should be a simple f-string replacement, but I don't want to bork a bunch of other stuff in the process! Want to point me in the right direction?
Ryan
After issuing the command gam create alias [email protected] user [email protected]
We own both domains and have been using them for three years or so now.
I then issue the command
gam user [email protected] add sendas [email protected] "Anne User" default
Sometimes this works and sometime it doesn't.
Sometimes it works after I try two or three times.
This happens whether it is one account or multiple accounts.
Today for example I had a csv of some 50 or so accounts to create and configure.
Using gam csv the first run failed on all of the accounts but at the second time of asking I ended up with 22 failures and almost 30 successes.
The error message is always
Add Failed: Unverified send-as cannot be set as the default
This has happened on and off over the years and most issues I have turned up online have been as a result of not creating the alias or not owning the domains. Neither applies to us.
Can anyone help?
Is there a way to verify the send-as from gam?
I have reverted to signing in as the user on past occasions and verifying the email address from the link in the email in the inbox or manually setting the send-as in settings.
This error occurs when I run the gam update project
command, while working through the How to Upgrade from Standard GAM wiki page. Instead of a Google page prompting me to authorize GAM to access my data, I get an error page from Google reading:
Sign in with Google temporarily disabled for this app
This app has not been verified yet by Google in order to use Google Sign In.
This appears to be the same problem as reported in Issue 1050 on the standard GAM project, and a screenshot of the error page is attached to this StackOverflow question.
Fortunately the solution given there by jay0lee to whitelist the GAM Creation project allowed me to move past this error, but I wanted to raise the issue here as well.
Does this work with 3.5 as well or requires 3.6?
First of all, Ross, thanks so much for all that you do. I rely heavily on your documentation to get my job done and I'm forever grateful.
I have been using this modification of the gam print cros command every since the chromebookinventory add-on was disabled. I know Kim made something and maybe I should just use that instead, but, using the GAM command has been getting the job done for me. I ordered it as follows:
gam print cros orderby lastsync fields orgUnitPath,annotatedUser,annotatedLocation,annotatedAssetId,notes,serialNumber,macAddress,ethernetMacAddress,deviceid,status,model,firmwareversion,lastsync,osversion,bootmode,supportenddate todrive
I last used it on Feb 12 and had gamadv-xtd3-4.98.14-windows-x86_64 installed. I went to use it yesterday, and some times I get 402 results, sometimes 602, sometimes 1102, but never the 6152 total devices no matter what their state. I have the device_max_results = 200 and installed gamadv-xtd3-4.99.20-windows-x86_64 yesterday and gamadv-xtd3-4.99.22-windows-x86_64 today with no difference. If I run the same command and remove the "todrive" it still returns a random amount of results every time. Lastly, if I run gam print cros todrive or gam print cros allfields todrive it works without issue.
Hi Ross,
Thank you for your amazing job !
I try to delete a sharedrive with this command :
gam user [email protected] delete teamdrive idxxx
And the result :
User: xxx, Shared Drive ID: xxx, Delete Failed: This resource cannot be deleted because it has children
Do we have to delete previously all the files and folders inside, then empty the trash and run the command?
Thank you
Pierre
Hi
Classes that have been deleted using "gam delete course " are still appearing when executing "GAM print courses". This would be a minor inconvenience, but this prevents "GAM print courses alias" as when GAM gets to one of the deleted classes it returns "ERROR: 404: notFound - Requested entity was not found."
Hi
Im getting this error
ERROR: Object of type 'bytes' is not JSON serializable
My command : gam user xxxxxx update photo xxxxxx.jpg
from just below this point
https://github.com/taers232c/GAMADV-XTD3/wiki/How-to-Upgrade-from-Standard-GAM#set-system-path
Hello,
c:\gamadv-xtd3>gam csv xyz.csv - gam update group [email protected] delete members ~Email
ERROR: unknown encoding: C:\GAM
Thanks in advance for any help
First time user of GAMADV, so no expert by any means. Have been using GAM for over 5 years though.
Installed 4.94.10 and had it working. Getting an error on the GAM CREATE CONTACT so decided to upgrade to the latest version, 5.00.12 and was unable to get it to run. The following error was produced:
Traceback (most recent call last):
File "Lib\site-packages\PyInstaller-4.0.dev0+3e6f7dc709-py3.8.egg\PyInstaller\loader\rthooks\pyi_rth_certifi.py", line 13, in
File "C:\python\lib\site-packages\pyinstaller-4.0.dev0+3e6f7dc709-py3.8.egg\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
File "ssl.py", line 98, in
ImportError: DLL load failed while importing _ssl: The specified module could not be found.
[12152] Failed to execute script pyi_rth_certifi
Downloaded and installed 5.00.11 and code ran without any errors.
System is Windows 10
Installed Python 3.7 and 3.8 just to see if maybe I needed python installed. Didn't help.
When I upgrade, how I do it with GAM, is just download the latest zip and extract it to the folder. If required, I'll run any commands to update the project if needed. This seems to work for this version as well, but I see it has many more options.
I am trying to update a specific sheet within a Google sheet. Based on the documentation I think the syntax should be the following, but I receive the error: "User: [email protected], Update 1 Drive File/Folder
User:[email protected], Service not applicable/Does not exist
gam user [email protected] update drivefile id gsheet id: localfile ./myfile.csv
I am not sure if my syntax is wrong, there is a bug in the program, or I am trying to do something that is unsupported.
I'm currently trying to batch-create a large number of users (~3000).
The ability to send the welcome email in GAM-X is awesome.
However, it GAM-X uses the Gmail API directly, which has very strict sending limits - these are on top of the API limits, and cannot be changed:
https://support.google.com/a/answer/166852?hl=en
Is there any way to use an external SMTP server, or mail service, to send these notification emails?
It would be great if this could be configurable, as you could point it to a mail service (e.g. Sendgrid), that did not have such limits.
Hi
When I launch a print command on a file which is a Gsite on My Drive it shows me only :
Readers are not print to my file !
Thanks
After upgrading to the latest version, I can no longer switch gam configurations using the "select" argument:
gam select default verify
ERROR: select is not a valid argument for "gam"
I tried to query the following, which perfectly works in API-Explorer, but leads to a KeyError-Exception in GAMADV-XTD3:
./gam user [email protected] show filelist fields id,properties query "properties has { key='CloudMigrator-Version' and value='3.15.5.0' }"
Getting all Drive Files/Folders that match query ('me' in owners and properties has { key='CloudMigrator-Version' and value='3.15.5.0' }) for [email protected]
Traceback (most recent call last):
File "gam.py", line 41948, in ProcessGAMCommand
File "gam.py", line 31631, in printFileList
File "gam.py", line 3566, in _processGAPIpagesResult
KeyError: " key='CloudMigrator-Version' and value='3"
Hello!
I'm experiencing crashes with large query results. I've tried using several different methods, but I haven't had success yet. Ultimately, I am trying to output all of the files which are shared from outside the organization. I have a pretty neat process, but it is choking sometimes on any output which contains more than 800k results. I think this has a high probability to be an issue with system resources, but I'm unsure. If you think it is too, I'll roll this into a forum post with more details regarding the resulting processes which I have found to be extremely efficient methods to mine the logs for data on a Windows platform.
My local environment:
Windows10 1809
Powershell ISE version 5.1
Using this command:
gam redirect stdout $outfile multiprocess redirect stderr $errorfile multiprocess batch $batchfile showcmds true 2>> $stderrfile
Batch file contents:
gam user user@domain print filelist showownedby others fields id,title,permissions,owners.emailaddress
To troubleshoot, I broke the command into separate processes with batches of 1 to try and rule out any limitations of powershell. I've also tried to split stderr out in a couple of ways in the hopes it would catch the error or number of files before the error occurred. It crashes with several users in our domain with access to many files.
Here's what was captured in the $errorfile log (stderr was very similar):
2020-04-03T13:37:36.661+00:00,0,Using 1 process...
2020-04-03T13:37:36.661+00:00,1,gam user user@domain print filelist showownedby others fields "id,title,permissions,owners.emailaddress"
2020-04-03T17:13:04.410+00:00,1,Complete
2020-04-03T17:13:04.425+00:00,0,Complete
Here's the Google Cloud Platform API usage over the duration of this users queries:
Hello,
I schedule a gam claim ownership every day, but it seems that it is not working.
The log states:
==> 2019-07-25 09:48:01 Claiming ownership for: [email protected]
ERROR: Connection error: [Errno 101] Network is unreachable
the error happens after about 45 minutes, ever time.
Doing it interactively on BASH prompt doesn't give any error.
Any idea?
Getting this error when running gam config no_browser true oauth create
So I started of by unselecting all and then adding scopes one by one (except for ' Pub / Sub API' and 'Reseller API' - those are unselected by default). With a lot of trial and error, I found out that I only get this error when enabling the scope 'Classroom API - Course Topics'.
For the time being, I don't need that one but it might affect some other people.
When running
gam user [email protected] show fileinfo query "name contains 'Aft er School 2018-2019'" fields id,title
I Get the following error:
ERROR: Connection error: [Errno 13] Permission denied: 'C:\\gamcfg\\gamcache\\ww w.googleapis.comdiscoveryv1apisdrivev3rest,9df7bd48bf964bd41ab30be7084dc28e'
Not sure exactly what this means?
I am trying to find this file, and take ownership of the file....My best guess is the error I get means this file has been trashed?
If I have a csv file with chromebook serial numbers, and I want to move all these devices into a specific OU, how could I achieve this with GAM ADV XTD3. For my case use, the csv file is called cow2.csv and has a header of serial (With Chromebook Serial Numbers).... the OU I want to move them to is /COWS/COW2
i am thinking something along these lines...
...
....
gam csv cow2.csv gam update cros ~serial orgUnitPath "/COWS/COW2"
When I try this it says:
"Add failed: Does not exist"
I didn't just want to update the wiki page without letting folks know. I was struggling to find the items you can use in the query
flag for ChromeOS devices. Google's latest page change seems to have removed the field definitions, so using wayback machine I was able to grab them.
As I was adding them, my markdown linter was going crazy and also allowed me to clean somethings up on the wiki page. I wanted to share it before adding and seeing if everyone was ok with the edit proposed. See gist here for the page.
https://gist.github.com/WardsParadox/b7ab1362f7a6f7ae2024b5de09feb8cc
Should be
annotatedassetid|assetid|asset|
GAMADV-XTD3/src/GamCommands.txt
Line 1035 in 7e3c917
Hi,
I am executing the following command
gam.exe redirect stdout stdout.txt multiprocess redirect stderr stderr.txt multiprocess batch test.csv
where test.csv contains about 31000 lines of
gam print group-members group [email protected]
gam print group-members group [email protected]
...
gam print group-members group [email protected]
This takes normally about 30 minutes (with 10 threads).
Sometimes (about 1 out of 10-20) the command hangs with the following symtoms
Using 10 processes...
Processing item 100
....
Processing item 30700
which are missing.
So it seems that the "master" gam process hangs somewere after all subprocesses are finnished normally and theire stdout+stderr are writen to the output/stderr streams (they show 0 bytes but are locked and probably alread written) but before writing its own stderr to the output stream.
How can i circumvent this error or debug this?
I am running this on a windows 2012 server
Hi Ross,
I'd like to contribute more to this tool (potential ideas include writing tests, more helpful exception messages, a gui/cli tool with prompts, amongst others) but the file size of the main gam.py is pretty unwieldy. Would you be open to me breaking it into some smaller modules that might be a little easier to work with?
I'm also going to try to contribute some sample commands to the docs when I figure them out. Some areas of the wiki are super helpful, and others are pretty sparse. All of which is incredibly helpful! Not meaning to be picky about a fantastic open source project, but just willing to contribute back if it's desired.
How can I edit the group subject prefix found under Settings โ Email Options in the Classic Groups?
I also didn't find that in the Group Settings API but I found an issue for that, please everybody star.
Does anybody know of a solution to automate that?
Maybe keep this issue open so that users can easily find it and go to star the issue for the missing API.
Creating or printing user delegations doesn't work. I tired different Cloud Shells, different G Suite Domains and and different users.
me@cloudshell:~/.gam$ gam user old.user delegate to sysadmin
User: [email protected], Service not applicable/Does not exist
me@cloudshell:~/.gam$ gam user old.user print delegates
User: [email protected], Service not applicable/Does not exist
User,delegateAddress,delegationStatus
me@cloudshell:~/.gam$ gam version
GAM 4.83.04 - https://github.com/taers232c/GAMADV-XTD
Ross Scroggs <[email protected]>
Python 2.7.16 64-bit final
google-api-python-client 1.7.8
httplib2 0.12.1
oauth2client 4.1.3
Linux-4.14.104+-x86_64-with-debian-9.9 x86_64
Path: /home/me/bin/gamadv-xtd
I'm using the following command to add users to groups:
~/bin/gamadv-xtd3/gam csv Users.csv gam update user ~email firstname ~firstname lastname ~lastname ou ~ou createifnotfound notify ~altemail password random groups ~group
Using 2 processes...
User: [email protected], Updated
User: [email protected], Created
User: [email protected], Add to 1 Group
Recipient: [email protected], Message: Account [email protected] password has been changed, Email Sent
Group: [email protected], Member: [email protected], Added
In this case, [email protected] is an existing user, [email protected] is a new user being created.
[email protected] was not added to the group in the CSV file, but test4 was created with the group in the CSV file.
Is it expected behaviour that groups are set for new users, but not updated for existing users?
When creating a new user, I get the following :
c:\gamwork>gam csv add_students.csv gam create user ~user_name first name ~first_name lastname ~last_name password 'ChangeMe19' Using 1 process... gam.py:20966: DeprecationWarning: the method passlib.handlers.sha2_crypt.sha512_ crypt.encrypt() is deprecated as of Passlib 1.7, and will be removed in Passlib 2.0, use .hash() instead. User: [email protected], Created
Encountering a hard stop error when running "create course" command when copyfrom is included. Verified content is stored in a user's personal Google Drive and shared so that anyone with the link can view. Happy to provide screenshots, code snips, or anything else as needed.
We tried using the gam create resoldcustomer
command to create a new customer but it attempted to read/write to a seemingly undocumented custInfo.json file. Even if we pre-create the create the file in the same directory, it still causes an error:
Traceback (most recent call last):
File "gam.py", line 42810, in ProcessGAMCommand
File "gam.py", line 8901, in doCreateResoldCustomer
File "json/init.py", line 357, in loads
File "json/decoder.py", line 337, in decode
File "json/decoder.py", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
My guess is that it fails to read the response from the Google API and thus, throws an exception. We tested this on Ubuntu 18.04 LTS on Python 3.6.8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.