Skip to content

Commit c1f19c7

Browse files
committed
Support verb pass through to enable silent install
1 parent 8e143f7 commit c1f19c7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

UnitySetup/UnitySetup.psm1

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

238238
[parameter(Mandatory=$false)]
239-
[string]$Cache = [io.Path]::Combine($env:USERPROFILE, ".unitysetup")
239+
[string]$Cache = [io.Path]::Combine($env:USERPROFILE, ".unitysetup"),
240+
241+
[parameter(Mandatory=$false)]
242+
[ValidateSet('Open','RunAs')]
243+
[string]$Verb
240244
)
241245

242246
process
@@ -299,10 +303,19 @@ function Install-UnitySetupInstance
299303
$installer = $localInstallers[$i]
300304
$destination = $localDestinations[$i]
301305

302-
$args = @("/S", "/D=$($localDestinations[$i])")
306+
$startProcessArgs = @{
307+
'FilePath' = $installer;
308+
'ArgumentList' = @("/S", "/D=$($localDestinations[$i])");
309+
'PassThru' = $true;
310+
}
311+
312+
if($Verb)
313+
{
314+
$startProcessArgs['Verb'] = $Verb
315+
}
303316

304317
$spinnerIndex = 0
305-
$process = Start-Process -FilePath $installer -ArgumentList $args -PassThru
318+
$process = Start-Process @startProcessArgs
306319
while(!$process.HasExited)
307320
{
308321
Write-Host "`rInstalling $installer to $destination - $($spins[$spinnerIndex++ % $spins.Length])" -NoNewline

0 commit comments

Comments
 (0)