PortValhalla/scripts/Windows/Scripts/Software.ps1

63 lines
1.5 KiB
PowerShell

. "$PSScriptRoot/Config.ps1";
enum InstallerAction {
Install
Configure
ConfigureUser
}
$null = New-Module {
$userArgument = "name";
<#
.SYNOPSIS
Installs the software.
#>
function Install-Software { }
<#
.SYNOPSIS
Configures the system for the software.
#>
function Set-SoftwareConfiguration { }
<#
.SYNOPSIS
Configures a user for the software.
.PARAMETER Name
The name of the user to configure.
#>
function Set-SoftwareUserConfiguration {
param(
[Parameter(Mandatory = $true)]
[string] $Name
)
}
function Start-SoftwareInstaller {
param(
[InstallerAction] $Action,
[hashtable] $Arguments
)
if (($null -eq $Action) -or ($action -eq ([InstallerAction]::Install))) {
Install-Software @Arguments;
} elseif ($action -eq ([InstallerAction]::Configure)) {
Set-SoftwareConfiguration @Arguments;
foreach ($user in Get-Users) {
$Arguments.Add($userArgument, $user);
Start-SoftwareInstaller -Action ([InstallerAction]::ConfigureUser) @Arguments;
}
} elseif ($action -eq ([InstallerAction]::ConfigureUser)) {
if ((-not $Arguments.Contains($userArgument)) -or ($null -eq $Arguments[$userArgument])) {
$Arguments.Add($userArgument, ($env:UserName));
}
Set-SoftwareUserConfiguration @Arguments;
}
}
}