ToastIT
March 12, 2020

Staying up to Date on PowerShell Releases with Update Notifications - #PS7Now

Posted on March 12, 2020  •  4 minutes  • 751 words

This post is part of the #PS7Now PowerShell Blog Week celebrating the general availability launch of PowerShell 7.

There's a lot of great content coming out this week from a number of different authors, so make sure you keep an eye on the hashtag over on Twitter or checkout the table at the bottom of this post for direct links!

During this week of blog posts about the latest PowerShell release , you’ll have read a lot about many of the new features it delivers and with any luck you’ve been sold on it and installed /updated it.

But now you’re itching for the next release and the next round of new features and bug fixes, right? How on earth are you meant to know when those are out? Are we going to have to do a blog week for each?

While it’s always fun to write about one of your favorite technologies, these are a lot of effort to put together (thanks Jeff !). Luckily, PowerShell 7 shipped with an answer: Update Notifications .

Once in a given 24 hours window, PowerShell checks to see if there is a new version available. This check happens three seconds (or more) after you’ve opened PowerShell for the first time in that window to limit any impact on performance.

Any subsequent time you open up a PowerShell session you’ll see the notification itself.

What Notifications Will I See?

By default, a generally available (GA) release will only be notified about the next GA release. Any preview and release candidate will be notified about all preview and GA releases.

What’s really cool, especially if you were only allowed to install PowerShell 7 in your environment because it has Long Term Support (LTS), is that you can specify that you only want to be notified about the next LTS release and not the releases in between.

Support is complicated, there's a page with info specifically for PowerShell.

The short and simplified version is that PowerShell 7's LTS is locked to that of .NET Core 3.1's release on 3 December 2019. Support lasts through until 3 December 2022.

"Current" (the GA releases that aren't LTS) releases are supported until three months after the release of the next current release.

In order to set this, you’ll want to configure an environment variable .

$Env:POWERSHELL_UPDATECHECK = 'LTS'

Note though that this only applies to your current session, so for that to work you’ll want to add it to your profile , or make it a persistent variable .

Ergh, How Do I Turn Them Off?

Spoilsport, but I won’t begrudge you the option! Much like setting the environment variable for only getting LTS notifications, you can also specify that you don’t want any. You do this by setting the variable to “Off”.

$Env:POWERSHELL_UPDATECHECK = 'Off'

In the interest of completeness, you can also set this to “Default” to set everything back to how it was out of the box.

$Env:POWERSHELL_UPDATECHECK = 'Default'

This has the same effect as the environment variable not being defined at all, so if you do persist it and want to go back to default you can just remove the variable completely.

What’s Happening Under the Hood?

There are three JSON endpoints out there, the one that is checked depends on the release used and the previously discussed environment variable.

Note: Preview installs actually check both the stable and preview endpoints. You won’t see GA info by querying the preview uri.

Because this data is available to anyone and everyone, you can really get your geek on and build your own update notifications. Maybe display a toast notification in the OS or send out an automatic tweet ?

I’ll leave that one to your imagination.

That’s a Wrap

This is my third and final post for this blog week celebrating the release of PowerShell 7. It’s been a blast, both in writing these posts and getting involved with the other authors on Twitter.

Make sure you go check out everything that’s been happening via the #PS7Now hashtag or click through to each of the authors here:

Author Twitter Blog
Adam Bertram @adbertram https://adamtheautomator.com
Dan Franciscus @dan_franciscus https://winsysblog.com
Dave Carroll @thedavecarroll https://powershell.anovelidea.org
Jeff Hicks @JeffHicks https://jdhitsolutions.com
Jonathan Medd @jonathanmedd https://www.jonathanmedd.net
Josh Duffney @joshduffney http://duffney.io
Mike Kanakos @MikeKanakos https://www.commandline.ninja
Prateek Singh @singhprateik https://ridicurious.com
Thomas Lee @doctordns https://tfl09.blogspot.com

Credit

Hero image by Birmingham Museums Trust on Unsplash

comments powered by Disqus
Follow me