fix: output in 6.1.2,6.1.3 update changelog
This commit is contained in:
@@ -15,12 +15,11 @@ function Format-MissingActions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$formattedResults = @()
|
$formattedResults = @{
|
||||||
foreach ($type in $actionGroups.Keys) {
|
Admin = $actionGroups["Admin"] -join ', '
|
||||||
if ($actionGroups[$type].Count -gt 0) {
|
Delegate = $actionGroups["Delegate"] -join ', '
|
||||||
$formattedResults += "$($type) actions missing: $($actionGroups[$type] -join ', ')"
|
Owner = $actionGroups["Owner"] -join ', '
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $formattedResults -join '; '
|
return $formattedResults
|
||||||
}
|
}
|
@@ -1,8 +1,6 @@
|
|||||||
function Test-MailboxAuditingE3 {
|
function Test-MailboxAuditingE3 {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
# Aligned
|
|
||||||
# Create Table for Details
|
|
||||||
# Parameters can be added if needed
|
# Parameters can be added if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -15,7 +13,6 @@ function Test-MailboxAuditingE3 {
|
|||||||
$DelegateActions = @("ApplyRecord", "Create", "FolderBind", "HardDelete", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateFolderPermissions", "UpdateInboxRules")
|
$DelegateActions = @("ApplyRecord", "Create", "FolderBind", "HardDelete", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateFolderPermissions", "UpdateInboxRules")
|
||||||
$OwnerActions = @("ApplyRecord", "Create", "HardDelete", "MailboxLogin", "Move", "MoveToDeletedItems", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules")
|
$OwnerActions = @("ApplyRecord", "Create", "HardDelete", "MailboxLogin", "Move", "MoveToDeletedItems", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules")
|
||||||
|
|
||||||
|
|
||||||
$allFailures = @()
|
$allFailures = @()
|
||||||
$allUsers = Get-AzureADUser -All $true
|
$allUsers = Get-AzureADUser -All $true
|
||||||
$processedUsers = @{} # Dictionary to track processed users
|
$processedUsers = @{} # Dictionary to track processed users
|
||||||
@@ -51,13 +48,13 @@ function Test-MailboxAuditingE3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$allFailures += "$userUPN`: AuditEnabled - False"
|
$allFailures += "$userUPN|False|||"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($missingActions) {
|
if ($missingActions) {
|
||||||
$formattedActions = Format-MissingActions $missingActions
|
$formattedActions = Format-MissingActions -missingActions $missingActions
|
||||||
$allFailures += "$userUPN`: AuditEnabled - True; $formattedActions"
|
$allFailures += "$userUPN|True|$($formattedActions.Admin)|$($formattedActions.Delegate)|$($formattedActions.Owner)"
|
||||||
}
|
}
|
||||||
# Mark the user as processed
|
# Mark the user as processed
|
||||||
$processedUsers[$user.UserPrincipalName] = $true
|
$processedUsers[$user.UserPrincipalName] = $true
|
||||||
@@ -66,7 +63,12 @@ function Test-MailboxAuditingE3 {
|
|||||||
|
|
||||||
# Prepare failure reasons and details based on compliance
|
# Prepare failure reasons and details based on compliance
|
||||||
$failureReasons = if ($allFailures.Count -eq 0) { "N/A" } else { "Audit issues detected." }
|
$failureReasons = if ($allFailures.Count -eq 0) { "N/A" } else { "Audit issues detected." }
|
||||||
$details = if ($allFailures.Count -eq 0) { "All Office E3 users have correct mailbox audit settings." } else { $allFailures -join " | " }
|
$details = if ($allFailures.Count -eq 0) {
|
||||||
|
"All Office E3 users have correct mailbox audit settings."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"UserPrincipalName|AuditEnabled|AdminActionsMissing|DelegateActionsMissing|OwnerActionsMissing`n" + ($allFailures -join "`n")
|
||||||
|
}
|
||||||
|
|
||||||
# Populate the audit result
|
# Populate the audit result
|
||||||
$params = @{
|
$params = @{
|
||||||
@@ -77,7 +79,6 @@ function Test-MailboxAuditingE3 {
|
|||||||
FailureReason = $failureReasons
|
FailureReason = $failureReasons
|
||||||
}
|
}
|
||||||
$auditResult = Initialize-CISAuditResult @params
|
$auditResult = Initialize-CISAuditResult @params
|
||||||
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Error "An error occurred during the test: $_"
|
Write-Error "An error occurred during the test: $_"
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
function Test-MailboxAuditingE5 {
|
function Test-MailboxAuditingE5 {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param (
|
param (
|
||||||
# Aligned
|
|
||||||
# Create Table for Details
|
|
||||||
# Parameters can be added if needed
|
# Parameters can be added if needed
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -15,8 +13,6 @@ function Test-MailboxAuditingE5 {
|
|||||||
$DelegateActions = @("ApplyRecord", "Create", "FolderBind", "HardDelete", "MailItemsAccessed", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateFolderPermissions", "UpdateInboxRules")
|
$DelegateActions = @("ApplyRecord", "Create", "FolderBind", "HardDelete", "MailItemsAccessed", "Move", "MoveToDeletedItems", "SendAs", "SendOnBehalf", "SoftDelete", "Update", "UpdateFolderPermissions", "UpdateInboxRules")
|
||||||
$OwnerActions = @("ApplyRecord", "Create", "HardDelete", "MailboxLogin", "Move", "MailItemsAccessed", "MoveToDeletedItems", "Send", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules")
|
$OwnerActions = @("ApplyRecord", "Create", "HardDelete", "MailboxLogin", "Move", "MailItemsAccessed", "MoveToDeletedItems", "Send", "SoftDelete", "Update", "UpdateCalendarDelegation", "UpdateFolderPermissions", "UpdateInboxRules")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$allFailures = @()
|
$allFailures = @()
|
||||||
$allUsers = Get-AzureADUser -All $true
|
$allUsers = Get-AzureADUser -All $true
|
||||||
$processedUsers = @{} # Dictionary to track processed users
|
$processedUsers = @{} # Dictionary to track processed users
|
||||||
@@ -30,10 +26,10 @@ function Test-MailboxAuditingE5 {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$licenseDetails = Get-MgUserLicenseDetail -UserId $user.UserPrincipalName
|
$licenseDetails = Get-MgUserLicenseDetail -UserId $user.UserPrincipalName
|
||||||
$hasOfficeE5 = ($licenseDetails | Where-Object { $_.SkuPartNumber -in $e5SkuPartNumbers }).Count -gt 0
|
$hasOfficeE5 = ($licenseDetails | Where-Object { $_.SkuPartNumber -in $e5SkuPartNumbers }).Count -gt 0
|
||||||
Write-Verbose "Evaluating user $($user.UserPrincipalName) for Office E5 license."
|
Write-Verbose "Evaluating user $($user.UserPrincipalName) for Office E5 license."
|
||||||
|
|
||||||
if ($hasOfficeE5) {
|
if ($hasOfficeE5) {
|
||||||
$userUPN = $user.UserPrincipalName
|
$userUPN = $user.UserPrincipalName
|
||||||
$mailbox = Get-EXOMailbox -Identity $userUPN -PropertySets Audit
|
$mailbox = Get-EXOMailbox -Identity $userUPN -PropertySets Audit
|
||||||
@@ -51,13 +47,13 @@ function Test-MailboxAuditingE5 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$allFailures += "$userUPN`: AuditEnabled - False"
|
$allFailures += "$userUPN|False|||"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($missingActions) {
|
if ($missingActions) {
|
||||||
$formattedActions = Format-MissingActions $missingActions
|
$formattedActions = Format-MissingActions -missingActions $missingActions
|
||||||
$allFailures += "$userUPN`: AuditEnabled - True; $formattedActions"
|
$allFailures += "$userUPN|True|$($formattedActions.Admin)|$($formattedActions.Delegate)|$($formattedActions.Owner)"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Write-Verbose "User $($user.UserPrincipalName) passed the mailbox audit checks."
|
Write-Verbose "User $($user.UserPrincipalName) passed the mailbox audit checks."
|
||||||
@@ -68,12 +64,15 @@ function Test-MailboxAuditingE5 {
|
|||||||
# Adding verbose output to indicate the user does not have an E5 license
|
# Adding verbose output to indicate the user does not have an E5 license
|
||||||
Write-Verbose "User $($user.UserPrincipalName) does not have an Office E5 license."
|
Write-Verbose "User $($user.UserPrincipalName) does not have an Office E5 license."
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prepare failure reasons and details based on compliance
|
# Prepare failure reasons and details based on compliance
|
||||||
$failureReasons = if ($allFailures.Count -eq 0) { "N/A" } else { "Audit issues detected." }
|
$failureReasons = if ($allFailures.Count -eq 0) { "N/A" } else { "Audit issues detected." }
|
||||||
$details = if ($allFailures.Count -eq 0) { "All Office E5 users have correct mailbox audit settings." } else { $allFailures -join " | " }
|
$details = if ($allFailures.Count -eq 0) {
|
||||||
|
"All Office E5 users have correct mailbox audit settings."
|
||||||
|
} else {
|
||||||
|
"UserPrincipalName|AuditEnabled|AdminActionsMissing|DelegateActionsMissing|OwnerActionsMissing`n" + ($allFailures -join "`n")
|
||||||
|
}
|
||||||
|
|
||||||
# Populate the audit result
|
# Populate the audit result
|
||||||
$params = @{
|
$params = @{
|
||||||
|
Reference in New Issue
Block a user