Auto-update PowerShell Core with Chocolatey
Now that the PowerShell team is releasing new bits on the PowerShell Core I thought we need to automate the update process and why not doing it with Chocolatey!
First we need to install Chocolatey if we don’t already have that installed.
Start PowerShell with elevated rights.
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Then we need to create a new profile in PowerShell, here’s a blog post about PowerShell profiles: https://blogs.technet.microsoft.com/heyscriptingguy/2013/01/04/understanding-and-using-powershell-profiles/
Start PowerShell and run the following command:
In the notepad window, add this line and then save it:
NOTE that this will auto-update PowerShell Core every time you start PowerShell Core with elevated rights.
choco upgrade powershell-core -y
Then start PowerShell Core with elevated rights and let the magic happen!