Closed dominikduennebacke closed 6 months ago
I know this Issue was opened a while ago, but just to verify does
Update-GSUser -User "john.doe@test.com" -Archived:$true
and
Update-GSUser -User "john.doe@test.com" -Archived:$false
work as expected with the existing function and meet your desired use case?
According to the Microsoft documentation for PowerShell Switch parameter design considerations
"Explicitly setting a switch from a boolean can be done with -MySwitch:$boolValue
and in splatting with $params = @{ MySwitch = $boolValue }.
To your point, the Update-GSUser.ps1 function parameters could be changed from switches to booleans, but this might break existing uses of the function by other users. Someone could also create an alternate version of the function that has booleans instead of switches as a difference, but that also seems a bit excessive if the above workaround is functional.
Hi @jeffreymcclain, sorry for my late reply as well.
Update-GSUser -User "john.doe@test.com" -Archived:$false
does work as expected. Thanks for pointing it out. I was not aware you can explicitly set a swich parameter.
I have hence closed the ticket.
Update-GSUser
allows archiving a user via the switch parameterArchived
. However I did not find a way to unarchive a user in the same manner. Ideally the parameter should be changed from type[switch]
to[bool]
where$true
represents archiving and$false
unarchiving.Current behavior for archiving
Desired behavior
This would match the Google Admin SDK API method users.update.