From 8e47fae09ce03d9c4011a9794961828b19564015 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 7 Jun 2023 21:57:00 +0200 Subject: [PATCH] Add script for backing up PuTTY --- scripts/Windows/Software/PuTTY/Manage.ps1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 scripts/Windows/Software/PuTTY/Manage.ps1 diff --git a/scripts/Windows/Software/PuTTY/Manage.ps1 b/scripts/Windows/Software/PuTTY/Manage.ps1 new file mode 100644 index 00000000..716bb7e4 --- /dev/null +++ b/scripts/Windows/Software/PuTTY/Manage.ps1 @@ -0,0 +1,16 @@ +. "$PSScriptRoot/../../Scripts/Context.ps1"; +$softwareName = "PuTTY"; +$configFile = "${softwareName}.reg"; + +function New-TempDirectory() { + $tempDir = Join-Path $([System.IO.Path]::GetTempPath()) $([System.IO.Path]::GetRandomFileName()); + $null = New-Item -ItemType Directory $tempDir; + return $tempDir; +} + +function Invoke-BackupPuTTY([Context] $context) { + $tempDir = New-TempDirectory; + $fileName = Join-Path "$tempDir" $configFile; + & reg export "HKCU\Software\SimonTatham" "$fileName" /y; + $context.Backup($tempDir, $context.SoftwareArchive($softwareName), @()); +}