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