PortValhalla/scripts/Windows/Software/PuTTY/Manage.ps1

32 lines
1 KiB
PowerShell

using namespace Microsoft.Win32;
param(
$Action,
[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;
};