From 4dcf4a6d6a26e7aa692a2bba425005916f638519 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 28 Aug 2024 13:00:37 +0200 Subject: [PATCH] Add scripts for backing up PuTTY --- scripts/Windows/Software/PuTTY/Manage.ps1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Software/PuTTY/Manage.ps1 b/scripts/Windows/Software/PuTTY/Manage.ps1 index cb6e5b56..17dd3045 100644 --- a/scripts/Windows/Software/PuTTY/Manage.ps1 +++ b/scripts/Windows/Software/PuTTY/Manage.ps1 @@ -5,10 +5,27 @@ param( [hashtable] $Arguments ) +. "$PSScriptRoot/../../Scripts/Restoration.ps1"; . "$PSScriptRoot/../../../Common/Scripts/Software.ps1"; +. "$PSScriptRoot/../../../Common/Scripts/System.ps1"; Start-SoftwareInstaller @PSBoundParameters ` -Installer { Install-ChocoPackage putty; + } ` + -UserBackup { + param([hashtable] $Arguments) + $dir = New-TemporaryDirectory; + $fileName = Join-Path "$dir" PuTTY.reg; + & reg export "HKCU\Software\SimonTatham\PuTTY" $fileName /y; + Add-BackupArtifacts -User $Arguments.Name -Source $fileName -Path "PuTTY/PuTTY.reg"; + Remove-Item -Recurse -Force $dir; + } ` + -UserConfigurator { + param([hashtable] $Arguments) + $dir = New-TemporaryDirectory; + $fileName = Join-Path "$dir" PuTTY.reg; + Expand-BackupArtifacts -User $Arguments.Name -Path "PuTTY/PuTTY.reg" -Target $fileName; + & reg import $fileName; + Remove-Item -Recurse -Force $dir; }; -# ToDo: Add restoration