Print users with bulk operations

142 views
Skip to first unread message

David Dennie

unread,
Jun 10, 2016, 4:01:58 AM6/10/16
to Google Apps Manager
I am trying to print users based on first and last name to get their email addresses.  I can successfully use the command gam print users query givenName:Bill familyName:Smith and it prints the users email address.  I have a large spreadsheet of users to remove but I only have first and last name.  The name of the file is remove.csv.  I am attempting to parse in the first and last name using the following command so that I can print out email addresses to delete the accounts.

gam csv remove.csv gam print users query givenName:~first familyName:~last

C:\gam>gam csv remove.csv gam print users query givenName:~first familyName:~last
starting 5 worker threads...
ERROR: familyName:~last is not a valid argument for "gam print users"

I have tried adding the ' and " in multiple locations and get the same error.

I tried parsing with just givenName and got the following error.

C:\gam>gam csv remove.csv gam print users query givenName:~first
starting 5 worker threads...
Traceback (most recent call last):
  File "<string>", line 9366, in <module>
  File "<string>", line 7489, in doPrintUsers
  File "<string>", line 813, in buildGAPIObject
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\oauth2client.util", line 137, in positional_wrapper
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\googleapiclient.discovery", line 203, in build
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\googleapiclient.discovery", line 249, in _retrieve_discovery_doc
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\oauth2client.client", line 622, in new_request
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\httplib2", line 1592, in request
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\httplib2", line 448, in _updateCache
  File "C:\Users\jlee\Documents\GitHub\gam363\src\build\gam\out00-PYZ.pyz\httplib2", line 715, in set
IOError: [Errno 22] invalid mode ('wb') or filename: u'c:\\gam\\gamcache\\www.googleapis.com,discovery,v1,apis,admin,directory_v1,rest,8dd26d939e03904b2171db8fe001343c'

C:\gam>gam csv remove1.csv gam print users query givenName ~first familyName ~last
starting 5 worker threads...
ERROR: Kyrie is not a valid argument for "gam print users"
ERROR: Zachary is not a valid argument for "gam print users"
ERROR: Layla is not a valid argument for "gam print users"
ERROR: Jacarria is not a valid argument for "gam print users"
ERROR: Zachary is not a valid argument for "gam print users"
ERROR: Brandon is not a valid argument for "gam print users"

C:\gam>gam csv remove1.csv gam print users query givenName '~first' familyName ~last
starting 5 worker threads...
ERROR: '~first' is not a valid argument for "gam print users"
ERROR: '~first' is not a valid argument for "gam print users"
ERROR: '~first' is not a valid argument for "gam print users"
ERROR: '~first' is not a valid argument for "gam print users"
ERROR: '~first' is not a valid argument for "gam print users"
ERROR: '~first' is not a valid argument for "gam print users"

C:\gam>gam csv remove1.csv gam print users query givenName=~first familyName=~last
starting 5 worker threads...
ERROR: familyName=~last is not a valid argument for "gam print users"
ERROR: familyName=~last is not a valid argument for "gam print users"
ERROR: familyName=~last is not a valid argument for "gam print users"
ERROR: familyName=~last is not a valid argument for "gam print users"
ERROR: familyName=~last is not a valid argument for "gam print users"
ERROR: familyName=~last is not a valid argument for "gam print users"

C:\gam>gam csv remove1.csv gam print users query 'givenName=~first familyName=~last'
starting 5 worker threads...
ERROR: familyName=~last' is not a valid argument for "gam print users"
ERROR: familyName=~last' is not a valid argument for "gam print users"
ERROR: familyName=~last' is not a valid argument for "gam print users"
ERROR: familyName=~last' is not a valid argument for "gam print users"
ERROR: familyName=~last' is not a valid argument for "gam print users"
ERROR: familyName=~last' is not a valid argument for "gam print users"

C:\gam>gam csv remove1.csv gam print users query 'givenName=~first and familyName=~last'
starting 5 worker threads...
ERROR: and is not a valid argument for "gam print users"
ERROR: and is not a valid argument for "gam print users"
ERROR: and is not a valid argument for "gam print users"
ERROR: and is not a valid argument for "gam print users"
ERROR: and is not a valid argument for "gam print users"
ERROR: and is not a valid argument for "gam print users"


Is it possible to do this?  If so, where am I going wrong?  I have a feeling I just need  " somewhere.  Thank you for any help you can provide.

Ross Scroggs

unread,
Jun 10, 2016, 8:03:32 AM6/10/16
to google-ap...@googlegroups.com
David,

~xxx must stand alone as an argument; if you want a column name embedded in an argument use ~~xxx~~. You must surround the entire query in '
Say: gam csv remove.csv gam print users query 'givenName:~~first~~ familyName:~~last~~'

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/bf1c51a4-45a1-4b6a-9543-32552be4f2a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages