29 lines
1,006 B
PowerShell
29 lines
1,006 B
PowerShell
#!/bin/pwsh
|
|
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
|
|
|
$null = New-Module {
|
|
$softwareName = "PuTTY";
|
|
$configFile = "$($softwareName).reg";
|
|
|
|
function Backup-PuTTY([Context] $context) {
|
|
Write-Host "Backing up PuTTY";
|
|
$tempDir = $context.GetTempDirectory();
|
|
$fileName = Join-Path "$tempDir" $configFile;
|
|
& reg export "HKCU\Software\SimonTatham" "$fileName" /y;
|
|
$context.Backup($tempDir, $context.SoftwareArchive($softwareName));
|
|
Remove-Item -Recurse $tempDir;
|
|
}
|
|
|
|
function Restore-PuTTY([Context] $context) {
|
|
Write-Host "Restoring PuTTY";
|
|
Write-Information "Installing PuTTY";
|
|
choco install -y putty;
|
|
|
|
Write-Information "Restoring configuration";
|
|
$tempDir = $context.GetTempDirectory();
|
|
$fileName = Join-Path "$tempDir" $configFile;
|
|
$context.Restore($context.SoftwareArchive($softwareName), $tempDir);
|
|
& reg import "$fileName";
|
|
Remove-Item -Recurse $tempDir;
|
|
}
|
|
}
|