get deviceID to match CSV data with serialNumber

163 views
Skip to first unread message

Todd Allen

unread,
Aug 8, 2023, 5:32:41 PM8/8/23
to GAM for Google Workspace
I'm trying to figure out how I can get all the deviceID's in our tenant to match up with an external list of serial numbers

gam redirect stdout ./DevTest.txt multiprocess redirect stderr stdout csv CBReEnable.csv gam print cros query "id:~~SerialNumber~~" fields deviceId,annotatedAssetId,serialNumber,annotatedLocation

the output file has other data.
Getting all CrOS Devices that match query (id:5CD9287MC7) for /, may take some time on a large Organizational Unit...

Got 1 CrOS Device that matched query (id:5CD9287MC7) for /...

Got 1 CrOS Device that matched query (id:5CD9287MC7)
deviceId,annotatedAssetId,serialNumber,annotatedLocation
bc699d24-2c81-419e-b7ff-c223bbd96ac7,00276573,5CD9287MC7,Technology Services
Getting all CrOS Devices that match query (id:5CD01459Y6) for /, may take some time on a large Organizational Unit...

Got 1 CrOS Device that matched query (id:5CD01459Y6) for /...

Got 1 CrOS Device that matched query (id:5CD01459Y6)
deviceId,annotatedAssetId,serialNumber,annotatedLocation
3329aff5-511e-40af-abdf-86ca522a14bb,00276733,5CD01459Y6,Sabino High School
Getting all CrOS Devices that match query (id:5CD9287MGW) for /, may take some time on a large Organizational Unit...

Is there a better way to just get the information needed:
3329aff5-511e-40af-abdf-86ca522a14bb,00276733,5CD01459Y6,Sabino High School

Thank you all for your help and wisdom.

Ross Scroggs

unread,
Aug 8, 2023, 5:42:07 PM8/8/23
to google-ap...@googlegroups.com
Todd,

You want redirect csv to capture the print cros data.
gam redirect csv ./DevTest.csv multiprocess redirect stdout ./DevTest.txt multiprocess redirect stderr stdout csv CBReEnable.csv gam print cros query "id:~~SerialNumber~~" fields deviceId,annotatedAssetId,serialNumber,annotatedLocation

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/51b801ba-f56c-430d-8372-082a5c0710a6n%40googlegroups.com.


--

Allen, Todd

unread,
Aug 8, 2023, 5:46:55 PM8/8/23
to google-ap...@googlegroups.com
that was the first command I tried, but the output file still had all the other items.

I am now trying the gam config csv_output_header_filter "deviceId,annotatedAssetId,serialNumber,annotatedLocation"  ...
the output file looks to be what I want with each line having both the data and headers. 
deviceId,annotatedAssetId,serialNumber,annotatedLocation
3329aff5-511e-40af-abdf-86ca522a14bb,00276733,5CD01459Y6,Sabino High School
deviceId,annotatedAssetId,serialNumber,annotatedLocation
eb7e4e08-7949-404a-b221-57a33784b078,00275649,5CD0145B7D,Hollinger K-8 School
deviceId,annotatedAssetId,serialNumber,annotatedLocation

Todd Allen
Senior Systems Engineer
Technology Services
Tucson Unified School District
1010 E 10th St, Tucson, AZ 85719
520-225-6455 – Phone
To book a Meeting
Time Zone: America/Phoenix MST (UTC-07:00)


From: google-ap...@googlegroups.com <google-ap...@googlegroups.com> on behalf of Ross Scroggs <ross.s...@gmail.com>
Sent: Tuesday, August 8, 2023 2:41 PM
To: google-ap...@googlegroups.com <google-ap...@googlegroups.com>
Subject: Re: [GAM] get deviceID to match CSV data with serialNumber
 
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/P5meJe6ZNrU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAJkvRS9KY01889bcxYfuYGbirBbpzQ9CKdWz2%2B5DawdpLaF-RA%40mail.gmail.com.

Allen, Todd

unread,
Aug 8, 2023, 5:54:05 PM8/8/23
to google-ap...@googlegroups.com
Ross, 
I went back and tryed your command and got this error message, but it looks to be also working.
PS C:\GAM-Scripts> gam redirect csv ./DevTest.csv multiprocess redirect stdout ./DevTest.txt multiprocess redirect stderr stdout csv CBReEnable.csv gam print cros query "id:~~SerialNumber~~" fields deviceId,annotatedAssetId,serialNumber,annotatedLocation
2023-08-08T14:50:06.133-07:00,0/32571,Using 5 processes...
Process Process-3:
Traceback (most recent call last):
  File "multiprocessing\process.py", line 314, in _bootstrap
  File "multiprocessing\process.py", line 108, in run
  File "__init__.py", line 9120, in CSVFileQueueHandler
  File "__init__.py", line 8030, in SetTimestampColumn
KeyError: 'output_timeformat'
2023-08-08T14:50:25.589-07:00,0,Processing item 100/32571
2023-08-08T14:50:45.951-07:00,0,Processing item 200/32571
2023-08-08T14:51:06.315-07:00,0,Processing item 300/32571


Todd Allen
Senior Systems Engineer
Technology Services
Tucson Unified School District
1010 E 10th St, Tucson, AZ 85719
520-225-6455 – Phone
To book a Meeting
Time Zone: America/Phoenix MST (UTC-07:00)

From: google-ap...@googlegroups.com <google-ap...@googlegroups.com> on behalf of Ross Scroggs <ross.s...@gmail.com>
Sent: Tuesday, August 8, 2023 2:41 PM
To: google-ap...@googlegroups.com <google-ap...@googlegroups.com>
Subject: Re: [GAM] get deviceID to match CSV data with serialNumber
 
You received this message because you are subscribed to a topic in the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/P5meJe6ZNrU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/CAJkvRS9KY01889bcxYfuYGbirBbpzQ9CKdWz2%2B5DawdpLaF-RA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages