Skip to content

Commit

Permalink
fix(BACKUP): optimise further
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Sep 7, 2024
1 parent 15e567c commit fbcfcec
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/playbook/Executables/BACKUP.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ if (Test-Path $FilePath) { exit }
$content = [System.Collections.Generic.List[string]]::new()
$content.Add("Windows Registry Editor Version 5.00")
Get-ChildItem "HKLM:\SYSTEM\CurrentControlSet\Services" | ForEach-Object {
if ((Get-ItemProperty $_.PSPath).PSObject.Properties.Name -contains "Start") {
$startValue = (Get-ItemProperty -Path $_.PSPath -Name "Start").Start
for ($c = 0; $c -le 4; $c++) {
if ($startValue -eq "0x$c") {
$content.Add("`n[$($_.Name)]")
$content.Add('"Start"=dword:0000000' + $c)
}
}
}
try {
$startValue = Get-ItemPropertyValue -Path $_.PSPath -Name "Start" -EA Stop
$content.Add("`n[$($_.Name)]")
$content.Add('"Start"=dword:0000000' + $startValue)
} catch {}
}

Set-Content -Path $FilePath -Value $content -Force -Encoding UTF8

0 comments on commit fbcfcec

Please sign in to comment.