Add a script for managing software
This commit is contained in:
parent
466813fe39
commit
f518ea07da
62
scripts/Windows/Scripts/Software.ps1
Normal file
62
scripts/Windows/Scripts/Software.ps1
Normal file
|
@ -0,0 +1,62 @@
|
|||
. "$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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue