- Powershell Core 6.2 Cookbook
- Jan Hendrik Peters
- 209字
- 2021-06-24 15:14:14
There's more...
Besides the installer that you can download and install manually or through any software deployment solution, you can also use Chocolatey. Chocolatey is a NuGet package source for binary packages and can be used to bootstrap software on a system.
The following steps will install Chocolatey and PowerShell Core on a Windows system. These steps require using Windows PowerShell for the initial process:
- Run the following command in Windows PowerShell (see https://chocolatey.org/docs/installation for details):
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- After the installation of Chocolatey, simply execute choco install powershell /y.
- Start PowerShell Core by searching for pwsh in the search bar!
If you're so inclined, compiling the code from scratch is of course also an option. Simply follow the guidelines laid out in the GitHub repository to do so:
# Clone the repository
git clone https://github.com/powershell/powershell
Set-Location -Path .\powershell
Import-Module ./build.psm1
# Ensure you have the latest version of .NET Core and other necessary components
Start-PSBootStrap
# Start the build process
Start-PSBuild
# Either run PowerShell directly...
& $(Get-PSOutput)
# ...or copy it to your favorite location (here: Program Files on Windows, necessary access rights required)
$source = Split-Path -Path $(Get-PSOutput) -Parent
$target = "$env:ProgramFiles\PowerShell\$(Get-PSVersion)"
Copy-Item -Path $source -Recurse -Destination $target