From cb2db3c1bdd0cd67e3209d8878334ace5fccfb09 Mon Sep 17 00:00:00 2001 From: KelvinTegelaar Date: Tue, 9 Jan 2024 10:09:49 +0100 Subject: [PATCH] int casting --- .../Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 index e1f94df1fa8d..16d810b82f09 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 @@ -6,8 +6,12 @@ function Push-CIPPAlertExpiringLicenses { $TriggerMetadata ) try { - Get-CIPPLicenseOverview -TenantFilter $QueueItem.tenant | Where-Object -Property 'TimeUntilRenew' -LT 29 | ForEach-Object { - Write-AlertMessage -tenant $($QueueItem.tenant) -message "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + Get-CIPPLicenseOverview -TenantFilter $QueueItem.tenant | ForEach-Object { + $timeTorenew = [int64]$_.TimeUntilRenew + if ($timeTorenew -lt 30 -and $_.TimeUntilRenew -gt 0) { + Write-Host "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + Write-AlertMessage -tenant $($QueueItem.tenant) -message "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + } } } catch { Write-AlertMessage -tenant $($QueueItem.tenant) -message "Error occurred: $(Get-NormalizedError -message $_.Exception.message)"