17
17
On Windows, add the absolute destination path to the 'User' scope environment variable 'Path';
18
18
On Linux, make the symlink '/usr/bin/pwsh' points to "$Destination/pwsh";
19
19
On MacOS, make the symlink '/usr/local/bin/pwsh' points to "$Destination/pwsh".
20
+ . EXAMPLE
21
+ Install the daily build
22
+ .\install-powershell.ps1 -Daily
23
+ . EXAMPLE
24
+ Invoke this script directly from GitHub
25
+ Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -daily"
20
26
#>
21
27
[CmdletBinding (DefaultParameterSetName = " Daily" )]
22
28
param (
@@ -38,12 +44,6 @@ param(
38
44
[Parameter (ParameterSetName = " MSI" )]
39
45
[switch ] $Quiet ,
40
46
41
- [Parameter (ParameterSetName = " MSI" )]
42
- [switch ] $AddExplorerContextMenu ,
43
-
44
- [Parameter (ParameterSetName = " MSI" )]
45
- [switch ] $EnablePSRemoting ,
46
-
47
47
[Parameter ()]
48
48
[switch ] $Preview
49
49
)
@@ -74,14 +74,6 @@ if (-not $UseMSI) {
74
74
} else {
75
75
if (-not $IsWinEnv ) {
76
76
throw " -UseMSI is only supported on Windows"
77
- } else {
78
- $MSIArguments = @ ()
79
- if ($AddExplorerContextMenu ) {
80
- $MSIArguments += " ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1"
81
- }
82
- if ($EnablePSRemoting ) {
83
- $MSIArguments += " ENABLE_PSREMOTING=1"
84
- }
85
77
}
86
78
}
87
79
@@ -314,20 +306,12 @@ try {
314
306
if ($IsWinEnv ) {
315
307
if ($UseMSI -and $Quiet ) {
316
308
Write-Verbose " Performing quiet install"
317
- $ArgumentList = @ (" /i" , $packagePath , " /quiet" )
318
- if ($MSIArguments ) {
319
- $ArgumentList += $MSIArguments
320
- }
321
- $process = Start-Process msiexec - ArgumentList $ArgumentList - Wait - PassThru
309
+ $process = Start-Process msiexec - ArgumentList " /i" , $packagePath , " /quiet" - Wait - PassThru
322
310
if ($process.exitcode -ne 0 ) {
323
311
throw " Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
324
312
}
325
313
} elseif ($UseMSI ) {
326
- if ($MSIArguments ) {
327
- Start-Process $packagePath - ArgumentList $MSIArguments - Wait
328
- } else {
329
- Start-Process $packagePath - Wait
330
- }
314
+ Start-Process $packagePath - Wait
331
315
} else {
332
316
Expand-ArchiveInternal - Path $packagePath - DestinationPath $contentPath
333
317
}
@@ -378,20 +362,12 @@ try {
378
362
if ($IsWinEnv ) {
379
363
if ($UseMSI -and $Quiet ) {
380
364
Write-Verbose " Performing quiet install"
381
- $ArgumentList = @ (" /i" , $packagePath , " /quiet" )
382
- if ($MSIArguments ) {
383
- $ArgumentList += $MSIArguments
384
- }
385
- $process = Start-Process msiexec - ArgumentList $ArgumentList - Wait - PassThru
365
+ $process = Start-Process msiexec - ArgumentList " /i" , $packagePath , " /quiet" - Wait - PassThru
386
366
if ($process.exitcode -ne 0 ) {
387
367
throw " Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
388
368
}
389
369
} elseif ($UseMSI ) {
390
- if ($MSIArguments ) {
391
- Start-Process $packagePath - ArgumentList $MSIArguments - Wait
392
- } else {
393
- Start-Process $packagePath - Wait
394
- }
370
+ Start-Process $packagePath - Wait
395
371
} else {
396
372
Expand-ArchiveInternal - Path $packagePath - DestinationPath $contentPath
397
373
}
0 commit comments