taers232c / gam-scripts3 Goto Github PK
View Code? Open in Web Editor NEWScripts for use with GAM - Python 3.6+
Scripts for use with GAM - Python 3.6+
➜ IT git:(fix-deprovision) ✗ python3 GetSharedFilePermissions.py filePerms.csv deletePerms.csv
Traceback (most recent call last):
File "GetSharedFilePermissions.py", line 70, in <module>
outputCSV.writerow({'Owner': row['owners.0.emailAddress'],
KeyError: 'owners.0.emailAddress'
I get this error when trying to run the Python script.
I'm trying this on a Windows host with Python 3.7 install and get the below error.
Steps:
Using GAMADV-XTD3
Run gam redirect csv ./filelistperms.csv user [email protected] print filelist id title permissions filepath to get the filelistperms.csv file
I run python GetPermissionsByPath.py filelistperms.csv pathperms.csv to get the permisions and it spit out below errors:
C:\GAMADV-XTD>python GetPermissionsByPath.py filelistperms.csv pathperms.csv
Traceback (most recent call last):
File "GetPermissionsByPath.py", line 60, in <module>
for p in xrange(0, numPaths):
NameError: name 'xrange' is not defined
Not sure where the issue is.
Thanks
Hello,
I am getting an 'ERROR: Invalid argument' when I try and run step #4. I am able to successfully run step #1 and create a list of all of my TeamDrives, but I get the error on step #4.
I am trying to get a list of TeamDrives to clean up empty ones and the old student folders. Thank you for your time.
When I run gam all users print filelist id title permissions owners mimetype query "(visibility='domainCanFind' or visibility='domainWithLink')" > filelistperms.csv
it shows in csv all сyrillic names as "â╨╢╨┤╨╡╨╜╨╕╤Ã
".
How can it be fixed? As far as I understand, text encoding must be UTF-8.
GAM-Scripts3/GetTeamDriveCountsSize.py
Line 67 in de3ee30
Good afternoon,
I've found an item that while it is not the fault of the script itself, I am curious if it can be handled within the script or if a subsequent "cleansing" step might be required.
Performing the following steps:
Results in:
C:\GAM\GoogleSharedWithSomeone>GetSharedWithUserDriveACLs.py filelistperms-UserWithNullInTitleOfDoc.csv delete-review-UserWithNullInTitleOfDoc.csv
Traceback (most recent call last):
File "C:\GAM\GoogleSharedWithSomeone\GetSharedWithUserDriveACLs.py", line 62, in <module>
for row in csv.DictReader(inputFile, quotechar=QUOTE_CHAR):
File "C:\Users\ArchchancellorMustrumRidcully\AppData\Local\Programs\Python\Python39\lib\csv.py", line 111, in __next__
row = next(self.reader)
_csv.Error: line contains NUL
I was able to look at the input file and see a "TitleofFileNUL" in the title field. For testing, I believe it can be recreated with any input file and inserting a NUL value in the Title (or perhaps anywhere).
Is there anyway to pre-cleanse the file, either within the script by searching for the appearance of a NUL (not merely whether or not the item is entirely null)?
I found this while processing an 8.4Gb csv file, it took a bit to find the needle in the haystack. I was able replicate the NUL in the export from both an OU level export and then by a named user export.
Thank you!
Hi,
Please can you help me determine the difference between GetSharedExternallyDriveACLs.py and GetNonDomainDriveACLs.py
Thanks
During the running GetSharedWithDomainDriveACLs.py:
Got 296 Files [email protected]...
Getting files for [email protected]...
Got 0 Files for [email protected]...
Getting files for [email protected]...
Got 2 Files for [email protected]...
After some times I have this error:
Traceback (most recent call last):
File "httplib2\__init__.py", line 1366, in _conn_request
File "httplib2\__init__.py", line 1142, in connect
File "socket.py", line 962, in getaddrinfo
socket.gaierror: [Errno 11001] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "google_auth_httplib2.py", line 119, in __call__
File "httplib2\__init__.py", line 1724, in request
File "httplib2\__init__.py", line 1444, in _request
File "httplib2\__init__.py", line 1373, in _conn_request
httplib2.error.ServerNotFoundError: Unable to find the server at oauth2.googleapis.com
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "gam\__main__.py", line 57, in <module>
File "gam\__main__.py", line 52, in main
File "gam\__init__.py", line 12369, in ProcessGAMCommand
File "gam\__init__.py", line 3324, in printDriveFileList
File "gam\__init__.py", line 1291, in buildDriveGAPIObject
File "gam\__init__.py", line 1260, in buildGAPIServiceObject
File "google\oauth2\service_account.py", line 429, in refresh
File "google\oauth2\_client.py", line 303, in jwt_grant
File "google\oauth2\_client.py", line 264, in _token_endpoint_request
File "google\oauth2\_client.py", line 213, in _token_endpoint_request_no_throw
File "google\oauth2\_client.py", line 189, in _perform_request
File "gam\transport.py", line 82, in wrapped_request_method
File "gam\transport.py", line 95, in __call__
File "google_auth_httplib2.py", line 126, in __call__
google.auth.exceptions.TransportError: Unable to find the server at oauth2.googleapis.com
[20948] Failed to execute script '__main__' due to unhandled exception!
How could I fix it?
I have ran the GAM command (gam all users print filelist id title permissions owners mimetype pm not domainlist mydomain.com > filelistperms.csv) and it takes all day to run it and when it's done the file is blank, with or without the domain clause. Is there a way to run this and query a specific ou and it's sub ous and only active users? Or do you have any idea why the file would be blank?
https://github.com/taers232c/GAM-Scripts3/blob/master/GetNonDomainFilterForwards.py
I tried these places, and didn't find any others that were logical.
Original command
gam config auto_batch_min 1 redirect csv ./filters.csv multiprocess all users print filters
My tries
gam select MyDomain config auto_batch_min 1 redirect csv ./filters.csv multiprocess all users print filters
gam config auto_batch_min 1 select MyDomain redirect csv ./filters.csv multiprocess all users print filters
gam config auto_batch_min 1 redirect csv ./filters.csv multiprocess select MyDomain all users print filters
They all failed while referring to a non-select oauth2.txt. Since my default oauth2.txt is blank, nothing happens, but error messages. The first position gave me many error messages, one for each user/thread/process, but the other two fail because of syntax.
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.