Skip to content

Commit 51ff626

Browse files
committed
fix: add license check
1 parent 8ecaf98 commit 51ff626

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableGuests.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@ function Invoke-CIPPStandardDisableGuests {
3333
#>
3434

3535
param($Tenant, $Settings)
36-
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuests'
36+
$TestResult = Test-CIPPStandardLicense -StandardName 'DisableGuests' -TenantFilter $Tenant -RequiredCapabilities @('AAD_PREMIUM', 'AAD_PREMIUM_P2')
37+
38+
if ($TestResult -eq $false) {
39+
#writing to each item that the license is not present.
40+
$settings.TemplateList | ForEach-Object {
41+
Set-CIPPStandardsCompareField -FieldName 'standards.DisableGuests' -FieldValue 'This tenant does not have the required license for this standard.' -Tenant $Tenant
42+
}
43+
Write-Host "We're exiting as the correct license is not present for this standard."
44+
return $true
45+
} #we're done.
46+
3747
$checkDays = if ($Settings.days) { $Settings.days } else { 90 } # Default to 90 days if not set. Pre v8.5.0 compatibility
3848
$Days = (Get-Date).AddDays(-$checkDays).ToUniversalTime()
3949
$Lookup = $Days.ToString('o')

0 commit comments

Comments
 (0)