fix: script analyzer reccomendations.
This commit is contained in:
@@ -12,7 +12,7 @@ The format is based on and uses the types of changes according to [Keep a Change
|
||||
- Added a new private function `Measure-AuditResult` to calculate and display audit results.
|
||||
- Enhanced error logging to capture failed test details and display them at the end of the audit.
|
||||
- Added a private function `Get-RequiredModule` to initialize the `$requiredModules` variable for better code organization in the main script.
|
||||
- Updated `Test-MailboxAuditingE3` and `Test-MailboxAuditingE5` functions to use `Format-MissingActions` for structuring missing actions into a pipe-separated table format.
|
||||
- Updated `Test-MailboxAuditingE3` and `Test-MailboxAuditingE5` functions to use `Format-MissingAction` for structuring missing actions into a pipe-separated table format.
|
||||
- Added more verbose logging to `Test-BlockMailForwarding` and improved error handling for better troubleshooting.
|
||||
- Improved `Test-RestrictCustomScripts` to handle long URL lengths better by extracting and replacing common hostnames, and provided detailed output.
|
||||
- Added sorting to output.
|
||||
|
@@ -60,7 +60,7 @@ function Test-MailboxAuditingE3_6.1.2_E3L1_IG1_IG2_IG3 {
|
||||
}
|
||||
|
||||
if ($missingActions) {
|
||||
$formattedActions = Format-MissingActions $missingActions
|
||||
$formattedActions = Format-MissingAction $missingActions
|
||||
$allFailures += "$userUPN`: AuditEnabled - True; $formattedActions"
|
||||
}
|
||||
# Mark the user as processed
|
||||
@@ -83,7 +83,7 @@ function Test-MailboxAuditingE3_6.1.2_E3L1_IG1_IG2_IG3 {
|
||||
}
|
||||
}
|
||||
|
||||
function Format-MissingActions {
|
||||
function Format-MissingAction {
|
||||
param ([array]$missingActions)
|
||||
|
||||
$actionGroups = @{
|
||||
|
@@ -60,7 +60,7 @@ function Test-MailboxAuditingE5_6.1.3_E5L1_IG1_IG2_IG3 {
|
||||
}
|
||||
|
||||
if ($missingActions) {
|
||||
$formattedActions = Format-MissingActions $missingActions
|
||||
$formattedActions = Format-MissingAction $missingActions
|
||||
$allFailures += "$userUPN`: AuditEnabled - True; $formattedActions"
|
||||
}
|
||||
else {
|
||||
@@ -92,7 +92,7 @@ function Test-MailboxAuditingE5_6.1.3_E5L1_IG1_IG2_IG3 {
|
||||
}
|
||||
}
|
||||
|
||||
function Format-MissingActions {
|
||||
function Format-MissingAction {
|
||||
param ([array]$missingActions)
|
||||
|
||||
$actionGroups = @{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
function Format-MissingActions {
|
||||
function Format-MissingAction {
|
||||
param ([array]$missingActions)
|
||||
|
||||
$actionGroups = @{
|
@@ -1,5 +1,6 @@
|
||||
function Get-RequiredModule {
|
||||
[CmdletBinding(DefaultParameterSetName = 'AuditFunction')]
|
||||
[OutputType([PSCustomObject])]
|
||||
param (
|
||||
[Parameter(Mandatory = $true, ParameterSetName = 'AuditFunction')]
|
||||
[switch]$AuditFunction,
|
||||
|
@@ -25,7 +25,7 @@ function Update-CISExcelWorksheet {
|
||||
|
||||
|
||||
# Update the worksheet with the provided data
|
||||
Update-WorksheetCells -Worksheet $worksheet -Data $Data -StartingRowIndex $StartingRowIndex
|
||||
Update-WorksheetCell -Worksheet $worksheet -Data $Data -StartingRowIndex $StartingRowIndex
|
||||
|
||||
# Save and close the Excel package
|
||||
Close-ExcelPackage $excelPackage
|
||||
|
@@ -1,4 +1,4 @@
|
||||
function Update-WorksheetCells {
|
||||
function Update-WorksheetCell {
|
||||
param (
|
||||
$Worksheet,
|
||||
$Data,
|
@@ -25,6 +25,8 @@
|
||||
https://criticalsolutionsnetwork.github.io/M365FoundationsCISReport/#Get-AdminRoleUserLicense
|
||||
#>
|
||||
function Get-AdminRoleUserLicense {
|
||||
# Set output type to System.Collections.ArrayList
|
||||
[OutputType([System.Collections.ArrayList])]
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $false)]
|
||||
|
@@ -49,7 +49,7 @@ function Test-MailboxAuditingE3 {
|
||||
}
|
||||
|
||||
if ($missingActions.Count -gt 0) {
|
||||
$formattedActions = Format-MissingActions -missingActions $missingActions
|
||||
$formattedActions = Format-MissingAction -missingActions $missingActions
|
||||
$allFailures += "$userUPN|True|$($formattedActions.Admin)|$($formattedActions.Delegate)|$($formattedActions.Owner)"
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ function Test-MailboxAuditingE5 {
|
||||
}
|
||||
|
||||
if ($missingActions.Count -gt 0) {
|
||||
$formattedActions = Format-MissingActions -missingActions $missingActions
|
||||
$formattedActions = Format-MissingAction -missingActions $missingActions
|
||||
$allFailures += "$userUPN|True|$($formattedActions.Admin)|$($formattedActions.Delegate)|$($formattedActions.Owner)"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user