diff --git a/scripts/Common/Scripts/Software.ps1 b/scripts/Common/Scripts/Software.ps1 index fb0e578c..b237ba2c 100644 --- a/scripts/Common/Scripts/Software.ps1 +++ b/scripts/Common/Scripts/Software.ps1 @@ -200,6 +200,7 @@ $null = New-Module { [scriptblock] $Backup = $null, [scriptblock] $Installer = $null, [scriptblock] $Configurator = $null, + [scriptblock] $UserBackup = $null, [scriptblock] $UserConfigurator = $null, [Nullable[InstallerAction]] $Action, [hashtable] $Arguments @@ -262,14 +263,26 @@ $null = New-Module { & $Configurator @argumentList; } } - ([InstallerAction]::ConfigureUser) { + default { if ((-not $Arguments.ContainsKey($userArgument)) -or (-not $Arguments[$userArgument])) { $Arguments.Add($userArgument, ($IsWindows ? $env:UserName : $env:USER)); } - if ($UserConfigurator) { - Write-Host "Configuring $Name for user ``$($Arguments[$userArgument])``…"; - & $UserConfigurator @argumentList; + $user = $Arguments[$userArgument]; + + switch ($_) { + ([InstallerAction]::BackupUser) { + if ($UserBackup) { + Write-Host "Backing up $Name for user ``$user``…"; + & $UserBackup @argumentList; + } + } + ([InstallerAction]::ConfigureUser) { + if ($UserConfigurator) { + Write-Host "Configuring $Name for user ``$user``…"; + & $UserConfigurator @argumentList; + } + } } } } diff --git a/scripts/Common/Types/InstallerAction.ps1 b/scripts/Common/Types/InstallerAction.ps1 index a4183fef..c06857ce 100644 --- a/scripts/Common/Types/InstallerAction.ps1 +++ b/scripts/Common/Types/InstallerAction.ps1 @@ -1,5 +1,7 @@ enum InstallerAction { + Backup Install Configure + BackupUser ConfigureUser }