Display the software name during installation
This commit is contained in:
parent
8295a41574
commit
985661a91e
|
@ -9,6 +9,20 @@ enum InstallerAction {
|
|||
$null = New-Module {
|
||||
$userArgument = "name";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the name of the software.
|
||||
#>
|
||||
function Get-SoftwareName {
|
||||
$path = ${Function:Install-Software}.File;
|
||||
|
||||
if ($path -ne "$PSCommandPath") {
|
||||
Split-Path -Leaf (Split-Path -Parent $path);
|
||||
} else {
|
||||
$null;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the software.
|
||||
|
@ -41,9 +55,19 @@ $null = New-Module {
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$null = $softwareName;
|
||||
|
||||
if ($null -ne (Get-SoftwareName)) {
|
||||
$softwareName = "``$(Get-SoftwareName)``";
|
||||
} else {
|
||||
$softwareName = "unknown software";
|
||||
}
|
||||
|
||||
if (($null -eq $Action) -or ($action -eq ([InstallerAction]::Install))) {
|
||||
Write-Host "Installing $softwareName…";
|
||||
Install-Software @Arguments;
|
||||
} elseif ($action -eq ([InstallerAction]::Configure)) {
|
||||
Write-Host "Configuring $softwareName…";
|
||||
Set-SoftwareConfiguration @Arguments;
|
||||
|
||||
foreach ($user in Get-Users) {
|
||||
|
@ -56,6 +80,7 @@ $null = New-Module {
|
|||
$Arguments.Add($userArgument, ($env:UserName));
|
||||
}
|
||||
|
||||
Write-Host "Configuring $softwareName for user ``$($Arguments[$userArgument])``…";
|
||||
Set-SoftwareUserConfiguration @Arguments;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue