Skip to content

Commit 4f9d93e

Browse files
committed
Added some PowerShell examples to the script
1 parent c679536 commit 4f9d93e

File tree

1 file changed

+10
-34
lines changed

1 file changed

+10
-34
lines changed

tools/install-powershell.ps1

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
On Windows, add the absolute destination path to the 'User' scope environment variable 'Path';
1818
On Linux, make the symlink '/usr/bin/pwsh' points to "$Destination/pwsh";
1919
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"
2026
#>
2127
[CmdletBinding(DefaultParameterSetName = "Daily")]
2228
param(
@@ -38,12 +44,6 @@ param(
3844
[Parameter(ParameterSetName = "MSI")]
3945
[switch] $Quiet,
4046

41-
[Parameter(ParameterSetName = "MSI")]
42-
[switch] $AddExplorerContextMenu,
43-
44-
[Parameter(ParameterSetName = "MSI")]
45-
[switch] $EnablePSRemoting,
46-
4747
[Parameter()]
4848
[switch] $Preview
4949
)
@@ -74,14 +74,6 @@ if (-not $UseMSI) {
7474
} else {
7575
if (-not $IsWinEnv) {
7676
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-
}
8577
}
8678
}
8779

@@ -314,20 +306,12 @@ try {
314306
if ($IsWinEnv) {
315307
if ($UseMSI -and $Quiet) {
316308
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
322310
if ($process.exitcode -ne 0) {
323311
throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
324312
}
325313
} 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
331315
} else {
332316
Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath
333317
}
@@ -378,20 +362,12 @@ try {
378362
if ($IsWinEnv) {
379363
if ($UseMSI -and $Quiet) {
380364
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
386366
if ($process.exitcode -ne 0) {
387367
throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
388368
}
389369
} 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
395371
} else {
396372
Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath
397373
}

0 commit comments

Comments
 (0)