Skip to content

Commit

Permalink
fix(BACKUP.ps1): exclude defender services
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Oct 6, 2024
1 parent d920bba commit cbf45c4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/playbook/Executables/BACKUP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ $content = [System.Collections.Generic.List[string]]::new()
$content.Add("Windows Registry Editor Version 5.00")
Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services" | ForEach-Object {
try {
$startValue = Get-ItemPropertyValue -Path $_.PSPath -Name "Start" -EA Stop
$content.Add("`n[$($_.Name)]")
$content.Add('"Start"=dword:0000000' + $startValue)
$values = Get-ItemProperty -Path $_.PSPath -Name 'Start', 'Description' -EA Stop
if ($values.Description -notmatch 'Windows Defender') {
$content.Add("`n[$($_.Name)]")
$content.Add('"Start"=dword:0000000' + $values.Start)
} else {
Write-Output "Excluding $($_.Name)..."
}
} catch {}
}

Expand Down

0 comments on commit cbf45c4

Please sign in to comment.