diff --git a/octopus-samples-instances/api-scripts/enforce-system-team-permissions.ps1 b/octopus-samples-instances/api-scripts/enforce-system-team-permissions.ps1 index 08bfd6b..78f7665 100644 --- a/octopus-samples-instances/api-scripts/enforce-system-team-permissions.ps1 +++ b/octopus-samples-instances/api-scripts/enforce-system-team-permissions.ps1 @@ -112,6 +112,11 @@ $teamScopedUserRoles = Invoke-OctopusApi -OctopusUrl $octopusUrl -endPoint "team $spaceIdList = @() foreach ($userRole in $teamScopedUserRoles.Items) { + if ($null -eq $userRole.SpaceId) + { + continue + } + if ($spaceIdList -notcontains $userRole.SpaceId) { Write-Verbose "Adding the space $($userRole.SpaceId) to the space list"