using namespace Microsoft.Win32; . "$PSScriptRoot/../../lib/Restoration.ps1"; . "$PSScriptRoot/../../lib/SoftwareManagement.ps1"; . "$PSScriptRoot/../../../lib/Software.ps1"; . "$PSScriptRoot/../../../lib/System.ps1"; Start-SoftwareInstaller @args ` -Installer { Install-ChocoPackage putty; } ` -UserBackup { param( [string] $Name, [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 "$Name/$Name.reg"; Remove-Item -Recurse -Force $dir; } ` -UserConfigurator { param( [string] $Name, [hashtable] $Arguments ) $dir = New-TemporaryDirectory; $fileName = Join-Path "$dir" PuTTY.reg; Expand-BackupArtifacts -User $Arguments.Name -Path "$Name/$Name.reg" -Target $fileName; & reg import $fileName; Remove-Item -Recurse -Force $dir; };