File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Modules/CIPPCore/Public/Alerts Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,20 @@ function Get-CIPPAlertOneDriveQuota {
44 Entrypoint
55 #>
66 [CmdletBinding ()]
7- Param (
7+ param (
88 [Parameter (Mandatory )]
99 $TenantFilter ,
1010 [Alias (' input' )]
11- [ValidateRange (0 , 100 )]
11+ [ValidateRange (0 , 100 )]
1212 [int ]$InputValue = 90
1313 )
1414
1515 try {
1616 $Usage = New-GraphGetRequest - tenantid $TenantFilter - uri " https://graph.microsoft.com/beta/reports/getOneDriveUsageAccountDetail(period='D7')?`$ format=application/json&`$ top=999" - AsApp $true
1717 if (! $Usage ) {
18- Write-AlertMessage - tenant $ ($TenantFilter ) - message " OneDrive quota Alert: Unable to get OneDrive usage: Error occurred: No data returned from API."
1918 return
2019 }
21- }
22- catch {
20+ } catch {
2321 $ErrorMessage = Get-NormalizedError - Message $_.Exception.Message
2422 Write-AlertMessage - tenant $ ($TenantFilter ) - message " OneDrive quota Alert: Unable to get OneDrive usage: Error occurred: $ErrorMessage "
2523 return
@@ -29,7 +27,7 @@ function Get-CIPPAlertOneDriveQuota {
2927 $OverQuota = $Usage | ForEach-Object {
3028 if ($_.StorageUsedInBytes -eq 0 -or $_.storageAllocatedInBytes -eq 0 ) { return }
3129 try {
32- $UsagePercent = [math ]::Round(($_.storageUsedInBytes / $_.storageAllocatedInBytes ) * 100 )
30+ $UsagePercent = [math ]::Round(($_.storageUsedInBytes / $_.storageAllocatedInBytes ) * 100 )
3331 } catch { $UsagePercent = 100 }
3432
3533 if ($UsagePercent -gt $InputValue ) {
You can’t perform that action at this time.
0 commit comments