-
Notifications
You must be signed in to change notification settings - Fork 1
Custom Installations
Non chocolatey based installations are discussed here.
Instruction to deploy powershell
,
New-Shell -Type Powershell
- First, closed all existing pwsh instances
- Then, invoke legacy powershell since we are updating to a pwsh 6 or later version (elevation is not required),
Not closing pwsh instances results
Move-Item : Access to the path 'C:\PFiles_x64\choco\pwsh' is denied.
At D:\Code\shell\Install-Pwsh.ps1:136 char:13
+ Move-Item "$Destination" "$Destination.old"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\PFiles_x64\choco\pwsh:DirectoryInfo) [Move-Item], IOException
+ FullyQualifiedErrorId : MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand
- Then, we deploy/upgrade,
# git default branch not updated on upstream yet!
Invoke-WebRequest https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/install-powershell.ps1 -OutFile Install-Pwsh.ps1
.\Install-Pwsh -Destination C:\PFiles_x64\choco\pwsh
Remove-Item Install-Pwsh.ps1
UseMSI
does not support custom destination,
.\Install-Powershell -UseMSI -Destination C:\PFiles_x64\choco\pwsh
throws error: Parameter set cannot be resolved using the specified named parameters
If we have we can definitely add those package params under $MSIArguments
so that custom path gets added.
} elseif ($UseMSI) {
if($MSIArguments) {
Start-Process $packagePath -ArgumentList $MSIArguments -Wait
... ... ...
refs
- Installing the MSI package, MS Docs
- Install-Powershell.ps1, github readme
dotcore-sdk ** Doesn't require admin privilege
For First Time Install only,
$Env:DOTNET_ROOT = $PFilesX64Dir + '\dotnet'
ref and on github repo - dotnet/install-scripts
Invoke-WebRequest https://raw.githubusercontent.com/dotnet/install-scripts/main/src/dotnet-install.ps1 -OutFile dotnet-install.ps1
dotnet-install -InstallDir $Env:DOTNET_ROOT -NoPath -Channel STS
Remove-Item dotnet-install.ps1
Specific latest release,
dotnet-install -InstallDir $Env:DOTNET_ROOT -NoPath -Channel STS -Version 7.0.100
For, Standard/GA versions, just use regular version string as showed above.
For LTS versions i.e., .Net 6 at the moment, please utilize,
dotnet-install -InstallDir $Env:DOTNET_ROOT -NoPath -Channel LTS
For, Release Candidate Versions please use, remember to get the full version from msft.com - dotnet download page
dotnet-install -InstallDir $Env:DOTNET_ROOT -NoPath -Channel STS -Version 7.0.100-rc.2.22477.23
Even though documentation says,
.PARAMETER Version
Default: latest
Represents a build version on specific channel. Possible values:
- latest - the latest build on specific channel
- 3-part version in a format A.B.C - represents specific version of build
examples: 2.0.0-preview2-006120, 1.1.0
latest is GA; 3 part version i.e., 1.1.0 does not work for RC either!
Set $GITHUB_TOKEN
then apply,
Install\OpenSSH.ps1
** For Reference, not for use
If we want to install in system32 we can utilize following code,
# Install in Sys32 like the system's openssh (windows capability)
$destDir = 'D:\Soft\openssh'
# Overwrite windows installed bins
$openSshBins = (Get-ChildItem 'C:\WINDOWS\System32\OpenSSH\').Name
Expand-Archive -Path "$destDir\OpenSSH-Win64.zip" -DestinationPath $destDir
takeown.exe /a /r /f C:\Windows\System32\OpenSSH\
icacls.exe 'C:\Windows\System32\OpenSSH' /grant 'BUILTIN\Administrators:(OI)(CI)F'
icacls.exe 'C:\Windows\System32\OpenSSH' /grant 'BUILTIN\Administrators:F' /t
Stop-Service ssh-agent
$openSshBins | ForEach-Object { Copy-Item -Path "$destDir\OpenSSH-Win64\$_" -Destination C:\Windows\System32\OpenSSH\ }
Start-Service ssh-agent