GAMX and CrOs Field Order

51 views
Skip to first unread message

Derry Lyons

unread,
Jan 3, 2020, 7:22:09 PM1/3/20
to GAM for G Suite

I have what is hope is a pretty newbie question - I know just enough PowerShell and GAM to be dangerous! I have a few fields I want to return about my Chromebooks, but for the life of me, I can't figure out the order of how the fields get returned! In my test case below, I'm just trying to pluck off 1, 2, 3 to get an idea. Any ideas of a better Powershell structure would be welcome too!

First the script, then some sample results...  any help would be most appreciated!! Thanks! :) Derry


$GAMcbs = C:\GAMADV-X\gam.exe print cros fields assetid,autoupdateexpiration,bootmode,deviceid,firmwareversion,lastenrollmenttime,lastsync,location,macaddress,model,notes,orgunitpath,osversion,platformversion,serialnumber,status,user

foreach ($entry in $GAMcbs) {

  write-host $entry;

  $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17 = $entry.Split(',');
  write-host "--------------------------------------";
  write-host "assetID $1";
#  write-host "annotatedLocation $2";
#  write-host "annotatedUser $3";
#  write-host "autoupdateexpiration $4";
  write-host "bootMode $5";
#  write-host "deviceID $6";
#  write-host "firmwareVersion $7";
#  write-host "lastEnrollmentTime $8";
#  write-host "lastSync $9";
#  write-host "macAddress $10";
#  write-host "model $11";
  write-host "notes $12";
  write-host "orgUnitPath $13";

-----------------
RESULTS:
assetID 86d5cc9a-d741-4f2c-ada2-d92f9bd477c2
bootMode 2015-10-27T20:06:15.826Z
notes 2019-12-19T18:21:36.586Z
orgUnitPath HP Chromebook 11 G3/G4/G4 EE
--------------------------------------
assetID 56a0cb51-c69b-4ec5-919a-aa7cb6c8a6fa
bootMode 2017-11-06T21:06:27.047Z
notes 2019-12-20T19:21:15.105Z
orgUnitPath HP Chromebook 11 G3/G4/G4 EE

Ross Scroggs

unread,
Jan 3, 2020, 8:05:58 PM1/3/20
to google-ap...@googlegroups.com
Derry,

Add sortheaders, this should give you a stable order; deviceId will be the first column, the remaining columns with be sorted.
$GAMcbs = C:\GAMADV-X\gam.exe print cros fields assetid,autoupdateexpiration,bootmode,deviceid,firmwareversion,lastenrollmenttime,lastsync,location,macaddress,model,notes,orgunitpath,osversion,platformversion,serialnumber,status,user sortheaders

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" 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/c0b67748-75a8-4337-abc0-ac7838dfaafa%40googlegroups.com.


--

Derry Lyons

unread,
Jan 8, 2020, 3:41:26 PM1/8/20
to GAM for G Suite
That did the trick! At least got them in a consistent order where I can parse them. THANK YOU! :)
Reply all
Reply to author
Forward
0 new messages