Chore: Code cleanup

This commit is contained in:
Gal Szkolnik 2023-07-21 00:00:10 +00:00
parent 0d4a19addd
commit 77b84f819b
1 changed files with 7 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class LogEntry {
[String]$Status,
[switch]$Quiet
){
if( $Close ) {
if( $Close ) {
$this.Active = $false
}
$this.Duration = [DateTime]::Now - $this.Timestamp
@ -150,7 +150,6 @@ function Invoke-LoggedAction{
# If the user doesn't exist, it will create the user.
# If the user isn't a member of the above mentioned group, add it to it.
# Display a report.
$UserName="Test User 01"
$script:Domain="unknown"
$Automation = @(
@ -200,9 +199,9 @@ $Automation = @(
}
)
try {
function Main{
foreach( $local:Action in $Automation ) {
Invoke-LoggedAction @Action -Quiet
Invoke-LoggedAction @Action -Quiet -ErrorAction Stop
}
$Group = Get-MgGroup -Filter "DisplayName eq 'Varonis Assignment Group'"
@ -270,6 +269,10 @@ try {
# In case of error, continue to the next user.
}
}
}
try {
Main
} catch {
# We are relying on the LogTrail to show us any problems.
}