Skip to content

Commit

Permalink
Merge pull request #1157 from Ren-Roros-Digital/AuditLogtruefalse
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey authored Oct 17, 2024
2 parents 306c8a2 + 88bd8d2 commit 1d26d0e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ function Invoke-CIPPStandardAuditLog {
##$Rerun -Type Standard -Tenant $Tenant -Settings $Settings 'AuditLog'

Write-Host ($Settings | ConvertTo-Json)
$AuditLogEnabled = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AdminAuditLogConfig' -Select UnifiedAuditLogIngestionEnabled).UnifiedAuditLogIngestionEnabled
$AuditLogEnabled = [bool](New-ExoRequest -tenantid $Tenant -cmdlet 'Get-AdminAuditLogConfig' -Select UnifiedAuditLogIngestionEnabled).UnifiedAuditLogIngestionEnabled

If ($Settings.remediate -eq $true) {
Write-Host 'Time to remediate'

$DehydratedTenant = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig' -Select IsDehydrated).IsDehydrated
if ($DehydratedTenant) {
if ($DehydratedTenant -eq $true) {
try {
New-ExoRequest -tenantid $Tenant -cmdlet 'Enable-OrganizationCustomization'
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Organization customization enabled.' -sev Info
Expand All @@ -50,7 +50,7 @@ function Invoke-CIPPStandardAuditLog {
}

try {
if ($AuditLogEnabled) {
if ($AuditLogEnabled -eq $true) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Unified Audit Log already enabled.' -sev Info
} else {
New-ExoRequest -tenantid $Tenant -cmdlet 'Set-AdminAuditLogConfig' -cmdParams @{UnifiedAuditLogIngestionEnabled = $true }
Expand All @@ -64,7 +64,7 @@ function Invoke-CIPPStandardAuditLog {
}
if ($Settings.alert -eq $true) {

if ($AuditLogEnabled) {
if ($AuditLogEnabled -eq $true) {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Unified Audit Log is enabled' -sev Info
} else {
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Unified Audit Log is not enabled' -sev Alert
Expand Down

0 comments on commit 1d26d0e

Please sign in to comment.