Skip to content

Commit 8f1801e

Browse files
committed
Update Invoke-CIPPStandardSPFileRequests.ps1
1 parent a2d86cc commit 8f1801e

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ function Invoke-CIPPStandardSPFileRequests {
3434
$TestResult = Test-CIPPStandardLicense -StandardName 'SPFileRequests' -TenantFilter $Tenant -RequiredCapabilities @('SHAREPOINTWAC', 'SHAREPOINTSTANDARD', 'SHAREPOINTENTERPRISE', 'ONEDRIVE_BASIC', 'ONEDRIVE_ENTERPRISE')
3535

3636
if ($TestResult -eq $false) {
37-
Write-Host "We're exiting as the correct license is not present for this standard."
37+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'The tenant is not licenced for this standard SPFileRequests' -sev Error
3838
return $true
3939
}
4040

41-
$CurrentState = Get-CIPPSPOTenant -TenantFilter $Tenant | Select-Object _ObjectIdentity_, TenantFilter, CoreRequestFilesLinkEnabled, OneDriveRequestFilesLinkEnabled, CoreRequestFilesLinkExpirationInDays, OneDriveRequestFilesLinkExpirationInDays
41+
try {
42+
$CurrentState = Get-CIPPSPOTenant -TenantFilter $Tenant | Select-Object _ObjectIdentity_, TenantFilter, CoreRequestFilesLinkEnabled, OneDriveRequestFilesLinkEnabled, CoreRequestFilesLinkExpirationInDays, OneDriveRequestFilesLinkExpirationInDays
43+
}
44+
catch {
45+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Failed to get current state of SPO tenant details' -sev Error
46+
return
47+
}
4248

4349
# Input validation
4450
if (($Settings.state -eq $null) -and ($Settings.remediate -eq $true -or $Settings.alert -eq $true)) {
45-
Write-LogMessage -API 'Standards' -tenant $tenant -message 'SPFileRequests: Invalid state parameter set' -sev Error
51+
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Invalid state parameter set for standard SPFileRequests' -sev Error
4652
return
4753
}
4854

@@ -66,7 +72,6 @@ function Invoke-CIPPStandardSPFileRequests {
6672
$AllSettingsCorrect = $StateIsCorrect -and $ExpirationIsCorrect
6773

6874
if ($Settings.remediate -eq $true) {
69-
Write-Host 'Time to remediate'
7075

7176
if ($AllSettingsCorrect -eq $false) {
7277
try {

0 commit comments

Comments
 (0)