diff --git a/src/playbook/Executables/BACKUP.ps1 b/src/playbook/Executables/BACKUP.ps1 index f6e2c1a543..3a89c3691f 100644 --- a/src/playbook/Executables/BACKUP.ps1 +++ b/src/playbook/Executables/BACKUP.ps1 @@ -5,15 +5,18 @@ param ( if (Test-Path $FilePath) { exit } -Add-Content -Path $FilePath -Value "Windows Registry Editor Version 5.00" +$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") { - Add-Content -Path $FilePath -Value ("`n" + "[" + $_.Name + "]") - Add-Content -Path $FilePath -Value ("`"Start`"=dword:0000000$c") + $content.Add("`n[$($_.Name)]") + $content.Add('"Start"=dword:0000000' + $c) } } } } + +Set-Content -Path $FilePath -Value $content -Force -Encoding UTF8 \ No newline at end of file