Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error handling when system requirements are missing #187

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ Function Protect-WindowsSecurity {
'Import-Module:Verbose' = $false
'Copy-Item:Force' = $true
'Copy-Item:ProgressAction' = 'SilentlyContinue'
'Test-Path:ErrorAction' = 'SilentlyContinue'
}
}

Expand Down Expand Up @@ -2610,8 +2611,10 @@ IMPORTANT: Make sure to keep it in a safe place, e.g., in OneDrive's Personal Va
}
}

Write-Verbose -Message 'Removing the working directory'
Remove-Item -Recurse -Path $WorkingDir -Force -ErrorAction SilentlyContinue
if (Test-Path -Path $WorkingDir) {
Write-Verbose -Message 'Removing the working directory'
Remove-Item -Recurse -Path $WorkingDir -Force
}

Write-Verbose -Message 'Disabling progress bars'
0..2 | ForEach-Object -Process { Write-Progress -Id $_ -Activity 'Done' -Completed }
Expand Down
7 changes: 5 additions & 2 deletions Harden-Windows-Security.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ Function Protect-WindowsSecurity {
'Import-Module:Verbose' = $false
'Copy-Item:Force' = $true
'Copy-Item:ProgressAction' = 'SilentlyContinue'
'Test-Path:ErrorAction' = 'SilentlyContinue'
}
}

Expand Down Expand Up @@ -2610,8 +2611,10 @@ IMPORTANT: Make sure to keep it in a safe place, e.g., in OneDrive's Personal Va
}
}

Write-Verbose -Message 'Removing the working directory'
Remove-Item -Recurse -Path $WorkingDir -Force -ErrorAction SilentlyContinue
if (Test-Path -Path $WorkingDir) {
Write-Verbose -Message 'Removing the working directory'
Remove-Item -Recurse -Path $WorkingDir -Force
}

Write-Verbose -Message 'Disabling progress bars'
0..2 | ForEach-Object -Process { Write-Progress -Id $_ -Activity 'Done' -Completed }
Expand Down