You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Modules/CIPPCore/Public/Functions/Test-CIPPStandardLicense.ps1
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,10 @@ function Test-CIPPStandardLicense {
27
27
[string]$TenantFilter,
28
28
29
29
[Parameter(Mandatory=$true)]
30
-
[string[]]$RequiredCapabilities
30
+
[string[]]$RequiredCapabilities,
31
+
32
+
[Parameter(Mandatory=$false)]
33
+
[switch]$SkipLog
31
34
)
32
35
33
36
try {
@@ -41,16 +44,20 @@ function Test-CIPPStandardLicense {
41
44
}
42
45
43
46
if ($Capabilities.Count-le0) {
44
-
Write-LogMessage-API 'Standards'-tenant $TenantFilter-message "Tenant does not have the required capability to run standard $StandardName`: The tenant needs one of the following service plans: $($RequiredCapabilities-join',')"-sev Error
45
-
Set-CIPPStandardsCompareField-FieldName "standards.$StandardName"-FieldValue "License Missing: This tenant is not licensed for the following capabilities: $($RequiredCapabilities-join',')"-Tenant $TenantFilter
46
-
Write-Host"Tenant does not have the required capability to run standard $StandardName - $($RequiredCapabilities-join','). Exiting"
47
+
if (!$SkipLog.IsPresent) {
48
+
Write-LogMessage-API 'Standards'-tenant $TenantFilter-message "Tenant does not have the required capability to run standard $StandardName`: The tenant needs one of the following service plans: $($RequiredCapabilities-join',')"-sev Error
49
+
Set-CIPPStandardsCompareField-FieldName "standards.$StandardName"-FieldValue "License Missing: This tenant is not licensed for the following capabilities: $($RequiredCapabilities-join',')"-Tenant $TenantFilter
50
+
Write-Host"Tenant does not have the required capability to run standard $StandardName - $($RequiredCapabilities-join','). Exiting"
51
+
}
47
52
return$false
48
53
}
49
54
Write-Host"Tenant has the required capabilities for standard $StandardName"
50
55
return$true
51
56
} catch {
52
-
Write-LogMessage-API 'Standards'-tenant $TenantFilter-message "Error checking license capabilities for standard $StandardName`: $($_.Exception.Message)"-sev Error
0 commit comments