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
234 stars 68 forks source link

Get-GSOrganizationalUnit fails on sub-level orgunits when using -SearchScope Base #355

Open sigvaldhoy opened 3 years ago

sigvaldhoy commented 3 years ago

Describe the bug Trying to use Get-GSOrganizationalUnit -SearchBase '/Gloppen kommune/Breim skule' -SearchScope Base fails with errror:

Get-GSOrganizationalUnit : Exception calling "Execute" with "0" argument(s): "Google.Apis.Requests.RequestError Org unit not found [404] Errors [ Message[Org unit not found] Location[ - ] Reason[notFound] Domain[global] ] " At line:1 char:1

  • Get-GSOrganizationalUnit -SearchBase '/Gloppen kommune/Breim skule' - ...
  • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
  • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-GSOrganizationalUnit

Searching for the same OU using Get-GSOrganizationalUnit -SearchBase 'id:03ph8a2z39nmgi7' -SearchScope Base works like expected.

To Reproduce Steps to reproduce the behavior:

  1. Create sub-level OU's, with white space in names
  2. Try to use Get-GSOrganizationalUnit with -SearchScope Base and path in SearchBase on sub-level OU's

Expected behavior Same result when using OU path and OU-id in SearchBase

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Suspect issue to be connected to white space in OU paths, but not confirmed

sigvaldhoy commented 2 years ago

This is not related to white-space, I get this on all sub-levels, also when there is no white-space. This also causes Update-GSOrganizationalUnit to fail on sub-level org-units

macf0x commented 2 years ago

Out of interest, how many OU's do you have in your tenant?

We have a substantial number to cover several 100 sites and functions.