Skip to content

Commit 0dea1db

Browse files
authored
Merge pull request #21 from jwittner/dev/silentInstall
Support verb pass through to enable silent install
2 parents 0a4542d + d4d74ed commit 0dea1db

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

UnitySetup/UnitySetup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
RootModule = 'UnitySetup'
1515

1616
# Version number of this module.
17-
ModuleVersion = '2.0'
17+
ModuleVersion = '2.1'
1818

1919
# Supported PSEditions
2020
# CompatiblePSEditions = @()

UnitySetup/UnitySetup.psm1

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ function Install-UnitySetupInstance
258258
[string]$Destination,
259259

260260
[parameter(Mandatory=$false)]
261-
[string]$Cache = [io.Path]::Combine($env:USERPROFILE, ".unitysetup")
261+
[string]$Cache = [io.Path]::Combine($env:USERPROFILE, ".unitysetup"),
262+
263+
[parameter(Mandatory=$false)]
264+
[ValidateSet('Open','RunAs')]
265+
[string]$Verb
262266
)
263267

264268
process
@@ -321,10 +325,19 @@ function Install-UnitySetupInstance
321325
$installer = $localInstallers[$i]
322326
$destination = $localDestinations[$i]
323327

324-
$args = @("/S", "/D=$($localDestinations[$i])")
328+
$startProcessArgs = @{
329+
'FilePath' = $installer;
330+
'ArgumentList' = @("/S", "/D=$($localDestinations[$i])");
331+
'PassThru' = $true;
332+
}
333+
334+
if($Verb)
335+
{
336+
$startProcessArgs['Verb'] = $Verb
337+
}
325338

326339
$spinnerIndex = 0
327-
$process = Start-Process -FilePath $installer -ArgumentList $args -PassThru
340+
$process = Start-Process @startProcessArgs
328341
while(!$process.HasExited)
329342
{
330343
Write-Host "`rInstalling $installer to $destination - $($spins[$spinnerIndex++ % $spins.Length])" -NoNewline

0 commit comments

Comments
 (0)