Skip to content

Commit 3adf41e

Browse files
authored
Merge pull request KelvinTegelaar#1646 from kris6673/disableGuestsLogging
Fix: Improve logging for backwards compatibility in DisableGuests standard
2 parents be8c68d + 583240e commit 3adf41e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Invoke-CIPPStandardDisableGuests {
3434

3535
param($Tenant, $Settings)
3636
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'DisableGuests'
37-
$checkDays = if ($Settings.days) { $Settings.days } else { 90 }
37+
$checkDays = if ($Settings.days) { $Settings.days } else { 90 } # Default to 90 days if not set. Pre v8.5.0 compatibility
3838
$Days = (Get-Date).AddDays(-$checkDays).ToUniversalTime()
3939
$Lookup = $Days.ToString('o')
4040
$AuditLookup = (Get-Date).AddDays(-7).ToUniversalTime().ToString('o')
@@ -65,7 +65,7 @@ function Invoke-CIPPStandardDisableGuests {
6565
}
6666
}
6767
} else {
68-
Write-LogMessage -API 'Standards' -tenant $tenant -message "No guests accounts with a login longer than $($Settings.days) days ago." -sev Info
68+
Write-LogMessage -API 'Standards' -tenant $tenant -message "No guests accounts with a login longer than $checkDays days ago." -sev Info
6969
}
7070

7171
}
@@ -74,9 +74,9 @@ function Invoke-CIPPStandardDisableGuests {
7474
if ($GraphRequest.Count -gt 0) {
7575
$Filtered = $GraphRequest | Select-Object -Property UserPrincipalName, id, signInActivity, mail, userType, accountEnabled, externalUserState
7676
Write-StandardsAlert -message "Guests accounts with a login longer than 90 days ago: $($GraphRequest.count)" -object $Filtered -tenant $tenant -standardName 'DisableGuests' -standardId $Settings.standardId
77-
Write-LogMessage -API 'Standards' -tenant $tenant -message "Guests accounts with a login longer than $($Settings.days) days ago: $($GraphRequest.count)" -sev Info
77+
Write-LogMessage -API 'Standards' -tenant $tenant -message "Guests accounts with a login longer than $checkDays days ago: $($GraphRequest.count)" -sev Info
7878
} else {
79-
Write-LogMessage -API 'Standards' -tenant $tenant -message "No guests accounts with a login longer than $($Settings.days) days ago." -sev Info
79+
Write-LogMessage -API 'Standards' -tenant $tenant -message "No guests accounts with a login longer than $checkDays days ago." -sev Info
8080
}
8181
}
8282
if ($Settings.report -eq $true) {

0 commit comments

Comments
 (0)