SCRT-HQ/PSGSuite

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

sigvaldhoy opened this issue · 2 comments

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):

  • OS: Windows Server 2016
  • PowerShell Version: 5.1.14393.4350
  • PSGSuite Version: 2.36.4

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

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

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.