-
Notifications
You must be signed in to change notification settings - Fork 89
Collections of ChromeOS Devices
- Python Regular Expressions Match function
- Definitions
-
CrOS Type Entity
- All ChromeOS devices
- A list of ChromeOS deviceIds
- A list of ChromeOS device serial numbers
- ChromeOS devices directly in the Organization Unit
<OrgUnitItem>
- ChromeOS devices in the Organization Unit
<OrgUnitItem>
and all of its sub Organization Units - ChromeOS devices directly in the Organization Units
<OrgUnitList>
- ChromeOS devices in the Organization Units
<OrgUnitList>
and all of their sub Organization Units - ChromeOS devices that match a query
- ChromeOS devices that match any query in a list of queries
- ChromeOS deviceIds in a flat file/Google Doc
- ChromeOS serial numbers in a flat file/Google Doc
- Selected ChromeOS deviceIds in a CSV file/Google Sheet
- Selected ChromeOS serial numbers in a CSV file/Google Sheet
- ChromeOS devices from OUs in a flat file/Google Doc
- ChromeOS deviceIds from OUs in a CSV file/Google Sheet
- ChromeOS devices directly in or from OUs in a CSV file/Google Sheet
- ChromeOS deviceIds from data fields identified in a
csvkmd
argument
- Examples using CSV files
- Examples using multiple queries or Org Units
Command data from Google Docs/Sheets
gdoc <UserGoogleDoc>
and gsheet <UserGoogleSheet>
<CrOSTypeEntity> ::=
(all cros)|
(cros <CrOSIDList>)|
(cros_sn <SerialNumberList>)|
(cros_ou|cros_org <OrgUnitItem>)|
(cros_ou_and_children|cros_org_and_children <OrgUnitItem>)|
(cros_ous|cros_orgs <OrgUnitList>)|
(cros_ous_and_children|cros_orgs_and_children <OrgUnitList>)|
(crosquery <QueryCrOS>)|
(crosqueries <QueryCrOSList>)|
(crosfile|crosfile_sn
(<FileName>|(gdoc <UserGoogleDoc>)
[charset <Charset>] [delimiter <Character>]))|
(croscsvfile|croscsvfile_sn
((<FileName>(:<FieldName>)+)|(gsheet(:<FieldName>)+ <UserGoogleSheet>)
[charset <Charset>] [warnifnodata] [columndelimiter <Character>] [quotechar <Character>])
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>])|
(datafile cros|cros_sn|cros_ous|cros_ous_and_children
(<FileName>|(gdoc <UserGoogleDoc>) [charset <Charset>] [delimiter <Character>]))|
(csvdatafile cros|cros_sn|cros_ous|cros_ous_and_children
((<FileName>(:<FieldName>)+)|(gsheet(:<FieldName>)+ <UserGoogleSheet>)
[charset <Charset>] [warnifnodata] [columndelimiter <Character>] [quotechar <Character>])
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>])|
(csvkmd cros|cros_sn|cros_ous|cros_ous_and_children
(<FileName>|(gsheet <UserGoogleSheet>)
[charset <Charset>] [warnifnodata] [columndelimiter <Character>] [quotechar <Character>])
[endcsv|(fields <FieldNameList>)]
(keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])+
(subkeyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])
(matchfield|skipfield <FieldName> <RegularExpression>)*
(datafield <FieldName>(:<FieldName)* [delimiter <Character>])*)|
(croscsvdata <FieldName>(:<FieldName>*))
Use these options to select Chrome OS devices for GAM commands.
all cros
cros <CrOSList>
cros_sn <SerialNumberList>
cros_ou|cros_org <OrgUnitItem>
cros_ou_and_children|cros_org_and_children <OrgUnitItem>
cros_ous|cros_orgs <OrgUnitList>
<OrgUnitList>
may require special quoting based on whether the OUs contain spaces, commas or single quotes.
For quoting rules, see: List Items
cros_ous_and_children|cros_orgs_and_children <OrgUnitList>
<OrgUnitList>
may require special quoting based on whether the OUs contain spaces, commas or single quotes.
For quoting rules, see: List Items
crosquery <QueryCrOS>
See https://support.google.com/chrome/a/answer/1698333
crosqueries <QueryCrOSList>
See https://support.google.com/chrome/a/answer/1698333
<QueryCrOSList>
may require special quoting based on whether the queries contain spaces, commas or single quotes.
- Surround
<QueryCrOSList>
with" "
- Surround each query with
\" \"
, separate the queries with commas.
queries "\"orgUnitPath='/Path/To/OU 1'\",\"orgUnitPath='/Path/To/OU 2'\",\"orgUnitPath='/Path/To/OU 3'\""
-
crosfile (<FileName>|(gdoc <UserGoogleDoc>) [charset <Charset>] [delimiter <Character>])
-
<FileName>
- A flat file containing a single ChromeOS deviceId per row -
gdoc <UserGoogleDoc>
- A Google Doc containing a single ChromeOS deviceId per row -
delimiter <Character>
- There are multiple deviceIds per row separated by<Character>
; if not specified, there is single deviceId per row
-
-
crosfile_sn (<FileName>|(gdoc <UserGoogleDoc>) [charset <Charset>] [delimiter <Character>])
-
<FileName>
- A flat file containing a single ChromeOS serial number per row -
gdoc <UserGoogleDoc>
- A Google Doc containing a single ChromeOS serial number per row -
delimiter <Character>
- There are multiple serial numbers per row separated by<Character>
; if not specified, there is single serial number per row
-
-
croscsvfile (<FileName>(:<FieldName>)+ [charset <Charset>] [columndelimiter <Character>] [quotechar <Character>]) [endcsv|(fields <FieldNameList>)] (matchfield|skipfield <FieldName> <RegularExpression>)* [delimiter <Character>]
-
<FileName>(:<FieldName>)+
- A CSV file and the one or more columns that contain ChromeOS deviceIds -
gsheet(:<FieldName>)+ <UserGoogleSheet>
- A Google Sheet and the one or more columns that contain ChromeOS deviceIds -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
quotechar <Character>
- The column quote characer is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
delimiter <Character>
- There are multiple deviceIds per column separated by<Character>
; if not specified, there is single deviceId per column
-
-
croscsvfile_sn (<FileName>(:<FieldName>)+ [charset <Charset>] [columndelimiter <Character>] [quotechar <Character>]) [endcsv|(fields <FieldNameList>)] (matchfield|skipfield <FieldName> <RegularExpression>)* [delimiter <Character>]
-
<FileName>(:<FieldName>)+
- A CSV file and the one or more columns that contain ChromeOS deviceIds -
gsheet(:<FieldName>)+ <UserGoogleSheet>
- A Google Sheet and the one or more columns that contain ChromeOS deviceIds -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
quotechar <Character>
- The column quote characer is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
delimiter <Character>
- There are multiple deviceIds per column separated by<Character>
; if not specified, there is single deviceId per column
-
-
datafile cros|cros_ous|cros_ous_and_children (<FileName>|(gdoc <UserGoogleDoc>) [charset <Charset>] [delimiter <Character>])
-
cros|cros_ous|cros_ous_and_children
- The type of item in the file -
<FileName>
- A flat file containing a single item per row -
gdoc <UserGoogleDoc>
- A Google Doc containing a single item per row -
delimiter <Character>
- There are multiple items per row separated by<Character>
; if not specified, there is single item per row
-
-
csvdatafile cros|cros_ous|cros_ous_and_children (<FileName>(:<FieldName>)+ [charset <Charset>] [columndelimiter <Character>] [quotechar <Character>]) [endcsv|(fields <FieldNameList>)] (matchfield|skipfield <FieldName> <RegularExpression>)* [delimiter <Character>]
-
cros|cros_ous|cros_ous_and_children
- The type of item in the file -
<FileName>(:<FieldName>)+
- A CSV file and the one or more columns that contain ChromeOS deviceIds -
gsheet(:<FieldName>)+ <UserGoogleSheet>
- A Google Sheet and the one or more columns that contain ChromeOS deviceIds -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
quotechar <Character>
- The column quote characer is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
delimiter <Character>
- There are multiple deviceIds per column separated by<Character>
; if not specified, there is single deviceId per column
-
-
csvkmd cros|cros_ous|cros_ous_and_children (<FileName>|(gsheet <UserGoogleSheet>) [charset <Charset>] [columndelimiter <Character>] [quotechar <Character>]) [endcsv|(fields <FieldNameList>)] (keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])+ (matchfield|skipfield <FieldName> <RegularExpression>)* (datafield <FieldName>(:<FieldName)* [delimiter <Character>])*
-
cros|cros_ous|cros_ous_and_children
- The type of item in the file -
<FileName>
- A CSV file containing rows with columns of the type of item specified -
gsheet <UserGoogleSheet>
- A Google Sheet containing rows with columns of the type of item specified -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
quotechar <Character>
- The column quote characer is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])+
-
keyfield <FieldName>
- The column containing key values -
[keypattern <RegularExpression>] [keyvalue <String>]
- Allows transforming the value(s) in thekeyfield
column. If onlykeyvalue <String>
is specified, all instances of<FieldName>
inkeyvalue <String>
will be replaced by the item value. Ifkeypattern <RegularExpression>
is specified, the item value is matched against<RegularExpression>
and the matched segments are substituted intokeyvalue <String>
-
delimiter <Character>
- There are multiple values per keyfield column separated by<Character>
; if not specified, there is single value per keyfield column
-
-
(subkeyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])*
-
subkeyfield <FieldName>
- The column containing subkey values -
[keypattern <RegularExpression>] [keyvalue <String>]
- Allows transforming the value(s) in thesubkeyfield
column. If onlykeyvalue <String>
is specified, all instances of<FieldName>
inkeyvalue <String>
will be replaced by the item value. Ifkeypattern <RegularExpression>
is specified, the item value is matched against<RegularExpression>
and the matched segments are substituted intokeyvalue <String>
-
delimiter <Character>
- There are multiple values per subkeyfield column separated by<Character>
; if not specified, there is single value per subkeyfield column
-
-
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
(datafield <FieldName>(:<FieldName)* [delimiter <Character>])*
-
datafield <FieldName>(:<FieldName)*
- The column(s) containing data values -
delimiter <Character>
- There are multiple values per datafield column separated by<Character>
; if not specified, there is single value per datafield column
-
-
-
croscsvdata <FieldName>(:<FieldName>*)
- Data fields identified in acsvkmd
argument
You want to print information about ChromeOS devices at your school from Org Units based on graduation year.
Example 1
CSV File OrgUnit.csv, exactly the data you want, keypattern
and keyvalue
are not required.
OrgUnit
/Students/2020
/Students/2021
...
For each row, the value from the OrgUnit column is used as the Org Unit name.
gam csvkmd cros_ous OrgUnit.csv keyfield OrgUnit print cros
Example 2
CSV File GradYear.csv, you have to convert GradYear to Org Unit name /Students/GradYear
, keyvalue
is required.
GradYear
2020
2021
...
For each row, the value from the GradYear column replaces the keyField name in the keyvalue
argument and that value is used as the Org Unit name.
gam csvkmd cros_ous GradYear.csv keyfield GradYear keyvalue "/Students/GradYear" print cros
Example 3
CSV File GradYear.csv, you have to convert GradYear to Org Unit name /Students/LastTwoDigitsOfGradYear
, keypattern
and keyvalue
are required.
GradYear
2020
2021
...
For each row, the value from the GradYear column is matched against the keypattern
and the matched segments are substituted into the keyvalue
argument and that value is used as the Org Unit name.
gam csvkmd cros_ous GradYear.csv keyfield GradYear keypattern '20(..)' keyvalue '/Students/\1' print cros
Example 1 Print information about all ChromeOS devices with a serial number that starts with HY3 or 5CD.
gam crosqueries "id:HY3,id:5CD" print cros allfields nolists
Example 2 Print information about all ChromeOS devices in two Org Units that contain spaces in their names.
gam crosqueries "\"orgUnitPath='/Students/Middle School/2021'\",\"orgUnitPath='/Students/Middle School/2020'\"" print cros allfields nolists
This is equivaluent to:
gam cros_ous "'/Students/Middle School/2021','/Students/Middle School/2020'" print cros allfields nolists
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Uograde GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube