I managed to upgrade PowerShell at the start of the run and the agent will happily use it after installation.
You need to do two simple things.
- Install the PowerShell Core Preview onto the agent.
- Make PowerShell Core Preview the default by prepending the PATH environment variable.
Once you know how, it's easy:
- run: |
Invoke-Expression "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -preview -quiet"
"C:\Program Files\PowerShell\7-preview" >> $env:GITHUB_PATH
name: Upgrade to latest preview of powershell
# https://github.com/PowerShell/PowerShell/issues/17404#issuecomment-1188348379
The same trick would work on Azure Pipelines:
- pwsh: |
Invoke-Expression "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI -preview -quiet"
write-host "##vso[task.prependpath]c:\Program Files\PowerShell\7-preview"
Top comments (0)