-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReset-Databases.ps1
More file actions
42 lines (34 loc) · 1.33 KB
/
Copy pathReset-Databases.ps1
File metadata and controls
42 lines (34 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
param(
[switch]$Force
)
$ErrorActionPreference = "Stop"
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " SentryShield Database Reset" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
$dbDir = "C:\ProgramData\SentryShield"
if (-not $Force) {
$confirm = Read-Host "This will delete all vulnerabilities, history, and active threats in $dbDir. Are you sure? (Y/N)"
if ($confirm -notmatch "^[Yy]$") {
Write-Host "Reset cancelled." -ForegroundColor Yellow
exit
}
}
Write-Host "Stopping SentryShield services..." -ForegroundColor DarkGray
Stop-Process -Name SentryService -ErrorAction SilentlyContinue -Force
Stop-Process -Name SentryLegacyService -ErrorAction SilentlyContinue -Force
Stop-Process -Name SentryUI -ErrorAction SilentlyContinue -Force
$filesToDelete = @(
"vulnerability.db",
"sentry.db",
"sentry_history.db"
)
foreach ($file in $filesToDelete) {
$path = Join-Path $dbDir $file
if (Test-Path $path) {
Remove-Item $path -Force
Write-Host "Deleted: $path" -ForegroundColor Green
} else {
Write-Host "Not found: $path (Skipping)" -ForegroundColor DarkGray
}
}
Write-Host "`nDatabase reset complete! The databases will be recreated on next run." -ForegroundColor Cyan