I'm trying to use GAM to pull chromebook info. For anyone who knows, GAM is a command-line interface for Google Admin. The command I'm using specifically is
gam print cros limit_to_ou $ou basic
It spits out an array, but it does so with the first value being the actual headers.
$array[0] returns
deviceId,annotatedAssetId,annotatedLocation,annotatedUser,etc.
$array[1] returns
dev001,123456,Head Office,john.doe,etc.
The problem is, I need to be able to grab specific fields from the rest of the array. I need to pull the annotatedUser, and for logging I want the rest as well. But I need to do this ~9000 times.
Is there an easy way to convert this array to a PSCustomObject that I can use the $array[0] line as the header after a .Split(",")?
Part of me wonders if I don't just output to a CSV and then import it back.
I've been looking around, but this seems to be a very unique issue, and the answers I've seen don't look like they're applicable to my untrained eyes.