Add script for backing up PuTTY

This commit is contained in:
Manuel Thalmann 2023-06-07 21:57:00 +02:00
parent 69485f30ab
commit 8e47fae09c

View file

@ -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), @());
}