Skip to content

Commit 24fcd6b

Browse files
committed
fix: Fallback to legacy REST when CIPP client missing
1 parent 40cb7fc commit 24fcd6b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Modules/CIPPCore/Public/Invoke-CIPPRestMethod.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@ function Invoke-CIPPRestMethod {
8989
)
9090

9191
# ------------------------------------------------------------------
92-
# Escape hatch — env var kill switch or per-call legacy switch
92+
# Escape hatch — env var kill switch, missing pooled client type,
93+
# or per-call legacy switch
9394
# ------------------------------------------------------------------
94-
if ($UseLegacyInvokeRestMethod -or $env:DisableCIPPRestMethod -eq 'true') {
95+
$HasCippRestClient = $null -ne ('CIPP.CIPPRestClient' -as [type])
96+
if ($UseLegacyInvokeRestMethod -or $env:DisableCIPPRestMethod -eq 'true' -or -not $HasCippRestClient) {
9597
$LegacyParams = @{
9698
Uri = $Uri
9799
Method = $Method

0 commit comments

Comments
 (0)