Skip to content

Commit

Permalink
Fixed encoding and passed PSScriptAnalyzer checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahamedur committed Dec 18, 2024
1 parent 9a4b81b commit e554962
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions Hawk/Hawk.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
$script:ModuleRoot = $PSScriptRoot
$script:ModuleRoot = $PSScriptRoot
$script:ModuleVersion = (Import-PowerShellDataFile -Path "$($script:ModuleRoot)\Hawk.psd1").ModuleVersion

# Detect whether at some level dotsourcing was enforced
$script:doDotSource = Get-PSFConfigValue -FullName Hawk.Import.DoDotSource -Fallback $false
if ($Hawk_dotsourcemodule) { $script:doDotSource = $true }
Expand Down Expand Up @@ -47,7 +46,13 @@ function Import-ModuleFile

$resolvedPath = $ExecutionContext.SessionState.Path.GetResolvedPSPathFromPSPath($Path).ProviderPath
if ($doDotSource) { . $resolvedPath }
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($resolvedPath))), $null, $null) }
else {try {
$content = [io.file]::ReadAllText($resolvedPath)
$scriptBlock = [scriptblock]::Create($content)
$ExecutionContext.InvokeCommand.InvokeScript($false, $scriptBlock, $null, $null)
} catch {
Write-Error "Failed to import: $resolvedPath. Error: $_"
}}
}

#region Load individual files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
[array]$RoleAssignements = $null

# Look for E-Discovery Roles and who they might be assigned to
$EDiscoveryCmdlets = "New-MailboxSearch", "Search-Mailbox"
$EDiscoveryCmdlets = "New-ComplianceSearch", "New-ComplianceSearchAction"

# Find any roles that have these critical ediscovery cmdlets in them
# Bad actors with sufficient rights could have created new roles so we search for them
Expand Down
2 changes: 1 addition & 1 deletion Hawk/internal/functions/Out-LogFile.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<#
<#
.SYNOPSIS
Writes output to a log file with a time date stamp
.DESCRIPTION
Expand Down

0 comments on commit e554962

Please sign in to comment.