Make it easier to notify users that a new servicing release or newer GA release is available on non-preview builds. On preview builds, notify when new preview release is available.
We should probably push latest information to a well known Azure Blob during publishing time. On startup, have the check run on a separate thread to do the check and store some state (maybe just the latest version) on the system (probably a file). On next startup, if that file exists, compare versions and if running one is older, show the message.
Perhaps provide an Update-PowerShell cmdlet (don't know if it's already there...) and users who want it could call this in their $PROFILE? We should be careful when introducing interactive elements to the shell, because automation workflows that invoke PowerShell without -NonInteractive (which I assume is everywhere) could get broken.
If you're making Update-PowerShell, I propose the following prototype:
Function Update-PowerShell
{
[CmdletBinding(SupportsShouldProcess=$True,
ConfirmImpact='High')]
Param
(
[switch]$Automatic,
<# Not really needed from the perspective of functionality.
# Convenient alternative for -Confirm:$False
#>
[switch]$Force
)
Begin
{
If ($Force)
{
$local:ConfirmPreference = [System.Management.Automation.ConfirmImpact]::None;
}
$local:InstallPowerShellUpdate = {
If ($PSCmdlet.ShouldProcess('PowerShell new version', 'Install'))
{
Write-Host 'Install new version.';
}
Else
{
Write-Host 'Do not install because of WhatIf or denied confirmation.';
}
};
If ($Automatic)
{
Write-Host 'Check if a new version is already found and recorded.';
Write-Host 'If no new version is recorded:';
If ($PSCmdlet.ShouldProcess('PowerShell new version', 'Check in background'))
{
Write-Host 'Check in background.';
}
Write-Host 'If a new version is already recorded:';
. $InstallPowerShellUpdate;
}
Else
{
Write-Host 'Check the new version synchronously and report error.';
Write-Host 'If a new version is found:';
. $InstallPowerShellUpdate;
Write-Host 'If no new version is found:';
Write-Host "Write-Verbose 'PowerShell is up-to-date.'";
}
}
}
I'm sure it should not be in the engine.
This is the function of package managers, WindowsUpdate, secure scanners and so on. If customer OS system is well-configured (pre-configured) the customer always get the new version notification and get update.
The presence of non-standard features is always a problem for centralized management in the enterprise environment.
@iSazonov There isn't a good package manager story on Windows. Also, if the user isn't installing the package, but using the zip or tgz, they won't know there is a newer version. It would make sense if we want this notification to only be active for an interactive shell. Many apps (Chrome, VSCode) handle their own notification to the user that an update is available. Update-PowerShell is a bit more complicated particularly on Windows where open files can't be overwritten although it's possible to download it to a known location and on startup install it (using a helper process) if it's detected.
There isn't a good package manager story on Windows.
Windows has great update infrastructure. Standalone Internet connected computer always gets updates from WindowsUpdate. In isolated enterprise network WSUS and SCCM is great tools.
Firefox and Chrome have msi installers for enterprises.
It is products that do not have such capabilites create a headache for enterprise system administrators and annoy users with their reminders and notifications.
Also we cannot force users to use a newer version if they have no motivation or need (or it is disabled by local enterprise policy).
If we talk about security, then again this is a task for other products (WindowsUpdate, Windows Defender ...). It is too wasteful to inject in each utility its own update/notify tool.
We should probably push latest information to a well known Azure Blob during publishing time.
This would be nice, I would like more software to do something like this. If it was as simple as Invoke-RestMethod -Uri https://aka.ms/PowerShellCoreLatestVersionData with no login and no complex protocols, people could implement their own checks very easily.
Also, if the user isn't installing the package, but using the zip or tgz, they won't know there is a newer version.
The recent Telemetry RFC - that will feedback to Microsoft how often PowerShell Core is opened, and will include versions, is that right? If so, waiting until that is implemented could provide context for how many people are not updating, to see if this is a problem which needs solving. I feel that people who download PowerShell Core from a zip/tgz are the sort of people who will be able to update when they want to, or will know that they don't want to.
In the meantime, an opt-in mailing list "tell me when there are updates" on the download page, could be less effort (assuming Microsoft has existing mailing list infrastructure), and could indicate how much demand there is for knowing about new versions. I feel that people who download PowerShell zip/tgz are more likely to know about 3rd party package managers on Windows than the general population.
Note that Chrome installs a service, getting update approval once, and never prompting again. I think it only prompts if you leave the browser open for a long time, but if you close/open it regularly, the updates just happen. If there is going to be effort into an update mechanism, could that "ask once, do it for me" be an option for an MSI install?
I'm digressing, but I had published Update-PowerShellCore function in my module (PSCoreUpdate) a year ago.
This will be helpful for updating PowerShell Core on Windows and macOS.
After further thinking about this, I definitely would not want to have this opportunity on enterprice and cloud servers - OS images there should be managed centrally and have predictable versions of applications. This feature could be moved to our new decoupled helper module, which, when loaded in an interactive session, could check for a new version (in the background and with help -CheckNewVersion).
Just to add- if the newer version notification could also come when one calls $PSVersionTable to give a headsup to the user that they are current/behind that would be quite useful/timely