ChromeOS
Error
Add Failed: 400: invalidInput - Invalid Input: Inconsistent Orgunit id and path in request
This thread https://github.com/taers232c/GAMADV-XTD3/issues/225 posts that you need to run this command to fix this.
gam config update_cros_ou_with_id true save
However, there are still some users who still get an error and/or will not see an error, but the command will not work. It looks like this is just for updating the OU of devices. Try adding quickcrosmove on the end of the commmand. For example;-
gam crosquery "asset_id:<Asset ID>" update ou "</Path/To/New/OU>" quickcrosmove
This should be fixed in GAMADV-XTD3 6.22.12 onwards.
Configuring Output
Filtering Output
Using crosqueries "<Field Name>:<Field Option>". For example, to get the info for active Chromebooks or for a particular OU
gam crosqueries "status:active" print cros todrive basic
gam cros_ou "/Path/To/OU" print cros todrive basic
Order Headers
The order is based on the collumn header, not the field name searched in the GAM command.
gam print cros fields assetid,autoupdateexpiration,bootmode,deviceid,firmwareversion,lastenrollmenttime,lastsync,location,macaddress,model,notes,orgunitpath,osversion,platformversion,serialnumber,status,user sortheaders
Cros_OU Print Cros
Show device Directory API ID (deviceid), without header row
Note that for historical reasons, no header row is included, but you get the list in one API call, that shows the Directory API ID.
gam cros_ou "</Path/To/OU>" print cros
gam cros_ou_and_children "</Path/To/OU>" print cros
Show with header
This will include a header row.
gam cros_ou "</Path/To/OU>" print cros deviceid
gam cros_ou_and_children "</Path/To/OU>" print cros deviceid
Include more fields
Adding the basic option.
gam cros_ou "</Path/To/OU>" print cros basic
gam cros_ou_and_children "</Path/To/OU>" print cros basic
Or, for example, with specific fields
gam cros_ou "</Path/To/OU>" print cros fields activeTimeRanges,recentUsers,serialNumber orderby lastsync
gam cros_ou_and_children "</Path/To/OU>" print cros fields activeTimeRanges,recentUsers,serialNumber orderby lastsync
Multiple OUs in one command:
gam cros_ous "'</Path/To/OU1>','</Path/To/OU2>'" print cros deviceid
gam cros_ous_and_children "'</Path/To/OU1>','</Path/To/OU2>'" print cros deviceid
Note
(That's " '/Path/To/OU1','/Path/To/OU2' "; the extra quoting is only necessary if /Path/To/OU contains spaces.)
Info
Single device
gam cros <Device ID> info
gam cros_sn <Serial Number> info
gam cros_query "asset_id:<Asset ID>" info
IssueCommand
Wipe Single Device
To check the command run without the doit option.
gam cros <Device ID> issuecommand command wipe_users doit
gam cros_sn <Serial Number> issuecommand command wipe_users doit
gam cros_query "asset_id:<Asset ID>" issuecommand command wipe_users doit
Wipe Multiple Devices
gam cros_ou </Path/To/OU> issuecommand command wipe_users doit
gam cros_queries "asset_id:<Asset ID>,asset_id:<Asset ID>" issuecommand command wipe_users doit
Using Google Sheet
As we use the annotatedAssetId field for our own Asset numbers, we are more likely to run command against a sheet of these. This command can be run against a CSV, see here for more info.
gam csv gsheet <User Email Address> <File ID> <Sheet Name> gam cros_query "asset_id:~~annotatedAssetId~~" issuecommand command wipe_users doit
Powerwash
For the above settings change wipe_users to remote_powerwash.
Kiosk Mode
Additional options for Kiosk mode (not tested yet by me) are reboot, take_a_screenshot and set_volume <0-100>
Check Command
If you run a command when the device is offline, the inital state is PENDING. When the initial command is run it will also be given a CommandId. Use this CommandId with this command to check if the action has been taken.
gam cros_query "asset_id:<Asset ID>" getcommand commandid <CommandId>
Print Cros
Useful CrOSFieldNames
Listed on https://github.com/taers232c/GAMADV-XTD3/wiki/ChromeOS-Devices
orgunitpath |
LastSync (Updated)
Basic info on Chromebooks to check last updated and orderded by lastsync
gam print cros orderby lastsync ascending basic todrive
Report of ChromeOS devices with more fields and ordered by LastSync.
gam print cros todrive orderby lastsync ascending annotatedassetid annotatedlocation org serialnumber status annotateduser model lastsync OSversion
Limited Fields
Report of ChromeOS devices but only showing Location, AssetID, Serial Number & End of "Support" Date.
gam print cros todrive fields annotatedassetid annotatedlocation SerialNumber autoUpdateExpiration
Last Logged On
Date user last logged on to Chrome Devices.
gam print cros fields activeTimeRanges,recentUsers,serialNumber orderby lastsync | grep <User Email>
To output this data into a file add > filename.csv to the end of the command or todrive to output to Google Sheets.
One Line Per Device
Shows certain fields and one line per device. listlimit 1 is the command that controls the, one line per device, but this shows the older info for the device.
gam print cros todrive fields deviceID,activeTimeRanges,firmwareVersion,macAddress,model,osVersion,platformVersion,serialNumber,status,systemRamTotal listlimit 1
Devices user has logged into
gam print cros fields annotatedAssetId,serialNumber,macAddress,model,osVersion,lastSync,orgUnitPath,platformVersion activeTimeRanges recentusers query recent_user:<User Email Address> onerow listlimit 5 todrive
Registred Date Range
Specify the Date as yyyy-mm-dd.
gam print cros basic query "register:<From Date>..<To Date>" todrive
Using Regex
Searching for ChromeOS devices using annotatedAssetId. In this example ^$ equates to blank, so will list devices with no annotatedAssetId. Change this if a specific annotatedAssetId is needed.
gam config csv_output_row_filter "annotatedAssetId:regex:^$" print cros [allfields|full|basic]
Last User(s)
Add recentusers onerow to a command to show the last users logged onto a device. This will 'list' all the users in separate columns. To limit to the last user, add listlimit 1. For example;-
Search for the last user logged onto a specific device.
gam config csv_output_row_filter "annotatedAssetId:regex:<Asset ID>" print cros basic recentusers onerow listlimit 1 todrive
List all devices with the last users that logged onto them. Add [allfields|full|basic] (or specific fields) to get more fields than just deviceId and the last user.
gam print cros recentusers onerow listlimit 1 todrive
Last Sync & AutoExpiration Date
Last Sync less than <yyyy-mm-dd> and Auto Expiration Date less than <yyyy-mm-dd>.
gam config csv_output_row_filter "'lastsync:date<yyyy-mm-dd>','autoupdateexpiration:date<yyyy-mm-dd>'" redirect csv ./AUEdevices.csv print cros fields serialnumber,deviceid,lastsync,autoupdateexpiration todrive
Disk Space
Using the diskVolumeReports option you can work out how much disk space is free. So for a single device, using the Asset ID, this command will show all the diskVolumeReports for the device. There are multiple disks and it appears that diskVolumeReports.volumeInfo.0.storageFree and diskVolumeReports.volumeInfo.0.storageTotal can be used to determine the free space as reported in the Google Admin console.
gam print cros query "asset_id:<Asset ID>" diskVolumeReports todrive
autoUpdateExpiration
Devices expiring before a specific date.
gam config csv_output_row_filter "autoUpdateExpiration:date<yyyy-mm-dd" redirect csv ./devices.csv print cros fields serialnumber,deviceid,lastsync,autoupdateexpiration,notes,annotatedAssetId,model todrive
Print Cros Query
Basic Command
gam print cros [query <query>] [orderby location|user|lastsync|serialnumber|supportenddate] [ascending|descending] [todrive] [allfields|full|basic] [nolists] [listlimit <Number>] <CrOSFieldName>* [fields <CrOSFieldNameList>]
Recent User
gam print cros allfields query "recent_user:<User Email Address>" nolists todrive
Serial Number
Create a CVS of the serialNumber for the devices you need to query.
gam redirect csv ./target_info.csv multiprocess csv target.csv gam print cros query "id:~~serialNumber~~" fields serialnumber,ou,osVersion,status
AssetID - ActiveTimeRanges
reverselists activetimeranges at the end is only needed to show the most recent results first.
gam print cros query "asset_id:<AssetID>" fields activetimeranges listlimit 10 reverselists activetimeranges
Print Crosactivity
User
Find ChromeOS devices a user has used for an OU of Devices.
gam config csv_output_row_filter recentUsers.email:regex:<User Email Address> cros_ou </Path/To/OU> print crosactivity oneuserperrow todrive
Print Crostelemetry
By Serial Number
Display ChromeOS telemetry data for specific device. For a single device is may be easier to replace print with show so view the data in the terminal.
gam config csv_output_header_filter "deviceId,serialNumber,'.*0.systemRamFreeBytes','.*0.cpuTemperatureInfo.Core 0'" print crostelemetry cros_sn <Serial Number> fields serialnumber,cpustatusreport,memoryinfo,memorystatusreport listlimit 1
By Serial Number Show networkstatusreport
gam print crostelemetry cros_sn <Serial Number> fields networkstatusreport todrive
By Asset ID
gam print cros query "asset_id:<Asset ID>" fields serialnumber | gam csv - gam print crostelemetry filter "serialNumber=~~serialNumber~~"
Battery Status
Use the config csv_output_header_filter option to limit the fields shown in the report.
gam config csv_output_header_filter "deviceId,serialNumber,name,batteryInfo,batteryInfo.0.designCapacity,batteryInfo.0.designMinVoltage,batteryInfo.0.manufacturer,batteryInfo.0.serialNumber,batteryInfo.0.technology,batteryStatusReport.0.batteryHealth,batteryStatusReport.0.cycleCount,batteryStatusReport.0.fullChargeCapacity,batteryStatusReport.0.reportTime" print crostelemetry ou_and_children "</Path/To/Top/OU>" todrive
NetworkStatusReport
Command to find the Wifi status of devices. Create a Google Sheet and this <File ID> in the command.
gam redirect csv - todrive tdfileid <File ID> tdretaintitle tdtimestamp false tdsheet id:0 tdupdatesheet print crostelemetry ou_and_children </Path/To/Top/OU> fields networkStatusReport listlimit 1
Showdvrsfp
Disk Space
gam info cros <Device ID> showdvrsfp fields diskvolumereports
Update (Deprovision)
gam print cros > devices.csv
Or, to save to Google Drive
gam print cros todrive
By Device ID
These commands will just list all the Device ID. You may need to run a more thorough report to get more information to assist in fine tuning the list. For example, we use the Location field to show the owner of the Chrome device and change this to indicate if broken and therefore needs deprovisioning.
Then, after editing the CSV to only have Chrome devices to deprovision. Chose the <Action> from;-
deprovision_same_model_replace
deprovision_different_model_replace
deprovision_retiring_device
deprovision_upgrade_transfer
gam csv <CSV File>.csv gam update cros ~deviceId action <Action> acknowledge_device_touch_requirement
By Asset ID
gam csv gsheet <User Email Address> <FileID> "<Sheet Name>" gam crosquery "asset_id:~~annotatedAssetId~~" update action ~action acknowledge_device_touch_requirement
Update (Disable)
Single Device
Change <Action> to disable|reenable as required. To display a message/instructions you need to add to the Disabled device return instructions section in the Device Settings: Device > Chrome > Settings. This message can be set by OUs.
gam update cros cros_sn <Serial Number> action <Action>
OU
gam cros_ou "</Path/To/OU>" update action disable
Update (OU)
OU to OU
gam cros_ou </Path/To/Existing/OU> update ou </Path/To/New/OU> quickcrosmove
The top level OU of the domain is / and sub-OU therefore /OU/Sub-OU/etc.
Device SN & Location
gam cros_sn <Device Serial Number> update location <New Location>
Device SN & OU
gam cros_sn <Device Serial Number> update ou </Path/to/New/OU>
Asset ID & OU
See the note in the Error section for reasoning behind the addition of quickcrosmove on the end of the command.
gam crosquery "asset_id:<Asset ID>" update ou "</Path/To/New/OU>" quickcrosmove
From a gSheet and move OU
gam csv gsheet <User Email Address> <DriveFileID> <Sheet Name> gam update cros cros_sn "~sn" ou "</Path/to/New/OU>"
Updating using a CSV file
gam csv <CSV File>.csv gam update cros query "id:~~serial~~" ou "</Path/to/New/OU>"
gam csv <CSV File>.csv gam update cros query "asset_id:~~AssetID~~" ou "</Path/to/New/OU>"
By Status
gam update cros query "status:deprovisioned" ou "</Path/To/New/OU>"
Updatenotes
gSheet
The gSheet needs atleast 2 columns, deviceId & notes. Anything text in the notes column will be added to replaced by the corresponding text in the notes column for that Device. If the notes column is blank, all existing notes will be cleared.
gam csv gsheet <User Email Address> <File ID> "<Sheet Name>" gam update cros ~deviceId updatenotes "~~notes~~"
Append Notes
This command will append the notes field. The text will be added on a new line above the existing text
gam update cros cros_sn <Device Serial Number> updatenotes "<Note to Add>\n#notes#"
Working with CSV Files
Update Fields via CSV
I assume this can be used to update other fields as well, such as AssetId & Location.
gam csv <CSV File>.csv gam update cros ~deviceId notes ~notes
gam csv <CSV File>.csv gam update cros ~deviceId location ~annotatedLocation
Info for specific DeviceID
If you have a CSV file of specific DeviceID then this can be used to print a report for these devices. SerialNumber,ethernetMacAddress,macAddress can be changed as required
CSV with header row
gam croscsvfile <CSV File>.csv:deviceId print cros fields SerialNumber,ethernetMacAddress,macAddress todrive
Without header row
gam crosfile <CSV File>.csv print cros fields SerialNumber,ethernetMacAddress,macAddress todrive