SCRT-HQ / PSGSuite

Powershell module for Google / G Suite API calls wrapped in handy functions. Authentication is established using a service account via P12 key to negate the consent popup and allow for greater handsoff automation capabilities
https://psgsuite.io/
Apache License 2.0
235 stars 67 forks source link

[Enhancement] Update-GSChromeOSDevice #194

Closed Foggy2 closed 5 years ago

Foggy2 commented 5 years ago

It would be great if we could update the following ChromeOS device fields in Google Directory:

I think this would fit in with `Update-GSChromeOSDevice' perfectly.

Thanks!

scrthq commented 5 years ago

Hey @Foggy2 - Looks doable! Checking it out, thanks!

scrthq commented 5 years ago

Hey @Foggy2 - This has been deployed in v2.28.0! Let me know if all is well or if you are seeing any issues!

Foggy2 commented 5 years ago

Hi @scrthq I have been trying out this new feature but I have not been having any luck. Capture Each time I run the command, it appears to succeed but the properties on the device are not changed.

scrthq commented 5 years ago

@Foggy2 - if you do a Get-GSChromeOSDevice for that device after, does it still show as not updated? I've noticed some of Google's APIs will do that with update requests, it can be a bit offputting. Sanity checking the source though in case there's something off there!

Foggy2 commented 5 years ago

No, still blank unfortunately. image

I have also checked from the Google Admin Console and the fields are empty.

Have confirmed as well that the https://www.googleapis.com/auth/admin.directory.device.chromeos scope has been allowed in the Manage API Client Access screen.

scrthq commented 5 years ago

🤔 checking it out! Thanks for letting me know @Foggy2 !

Foggy2 commented 5 years ago

I think I see the issue.

Line 155 of Update-GSChromeOSDevice is $request = $service.Chromeosdevices.Patch($actionBody,$customerId,$dev) But I think it should be $request = $service.Chromeosdevices.Patch($Body,$customerId,$dev)

scrthq commented 5 years ago

You are 100% correct! Thanks for hunting that down, pushing a build now!

scrthq commented 5 years ago

@Foggy2 - alrighty, can you update to 2.28.2 and let me know? I'd test but I don't have any Chrome OS devices in either domain tbh 😨

Foggy2 commented 5 years ago

@scrthq Looks to be working as expected now. Thanks for your work on this!

scrthq commented 5 years ago

@Foggy2 - Woohoo! Thanks for your help as well!