skip powershell startup check for new version
Asked Answered
S

2

10

tl;dr How to force Powershell to skip checking for a new release?

When I start Powershell 7, it checks for a new version of Powershell.

Currently, this looks like

PowerShell 7.0.0
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

   A new PowerShell stable release is available: v7.1.3
   Upgrade now, or check out the release page at:
     https://aka.ms/PowerShell-Release?tag=v7.1.3

This check for a new release delays the start of Powershell. Sometimes this delay is ten to twenty seconds. It's mildly annoying. I'd like to skip the powershell release check.

Shelli answered 19/3, 2021 at 3:1 Comment(2)
I'm having the issue with 7.2.6 on a server with no Internet connection even after adding the UPDATE and OPTOUT system environment variables: github.com/PowerShell/PowerShell/issues/…. No matter what I do, PS7 wants to contact ctldl.windowsupdate.com upon startup, delaying the command prompt anywhere from 3-10 seconds.Boesch
@ErikAnderson I've noticed some changes in the 7.2 series and 7.3 series. The Answers below worked when I tried them for Powershell 7.0. It seems the Powershell team has added more checks that require contacting servers across the Internet. :-/ (I have not fully investigated this, just noticed some oddities in passing) The Answers below were correct for 7.0 Powershell. The Answers below need some additions for 7.2 Powershell.Shelli
D
3
$env:POWERSHELL_UPDATECHECK = 'Off'

By default, PowerShell subscribes to one of two different notification channels depending on its version/branch. Supported, Generally Available (GA) versions of PowerShell only return notifications for updated GA releases. Preview and Release Candidate (RC) releases notify of updates to preview, RC, and GA releases.

The update notification behavior can be changed using the POWERSHELL_UPDATECHECK environment variable. The following values are supported:

Off turns off the update notification feature
Default is the same as not defining POWERSHELL_UPDATECHECK:
GA releases notify of updates to GA releases
Preview/RC releases notify of updates to GA and preview releases
LTS only notifies of updates to long-term-servicing (LTS) GA releases

The change to $env:POWERSHELL_UPDATECHECK can be added to the Profile script at $profile.

notepad $profile

Source: https://toastit.dev/2020/03/13/ps7now-update-notifications/

Destinydestitute answered 19/3, 2021 at 3:11 Comment(1)
Yeah. adding this env variable in profile not works for me on MacOS. anyone else found a solution?Brookite
C
16

The accepted answer works for me, but with some adjustments.

Setting $env:POWERSHELL_UPDATECHECK = 'Off' in the PS profile $profile didn't disable the update checks.

I had to set the environment variable through system dialog: enter image description here

After setting the variable this way PS no longer hangs looking for the new version:

PowerShell 7.1.0
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS7 >
Chara answered 15/9, 2021 at 5:31 Comment(2)
Yes, the official documentation only mentions this solution: "The update notification behavior can be changed using the POWERSHELL_UPDATECHECK environment variable. The following values are supported: Off turns off the update notification feature" learn.microsoft.com/en-us/powershell/module/…Quasijudicial
Yeah. adding this env variable in profile not works for me on MacOS. anyone else found a solution?Brookite
D
3
$env:POWERSHELL_UPDATECHECK = 'Off'

By default, PowerShell subscribes to one of two different notification channels depending on its version/branch. Supported, Generally Available (GA) versions of PowerShell only return notifications for updated GA releases. Preview and Release Candidate (RC) releases notify of updates to preview, RC, and GA releases.

The update notification behavior can be changed using the POWERSHELL_UPDATECHECK environment variable. The following values are supported:

Off turns off the update notification feature
Default is the same as not defining POWERSHELL_UPDATECHECK:
GA releases notify of updates to GA releases
Preview/RC releases notify of updates to GA and preview releases
LTS only notifies of updates to long-term-servicing (LTS) GA releases

The change to $env:POWERSHELL_UPDATECHECK can be added to the Profile script at $profile.

notepad $profile

Source: https://toastit.dev/2020/03/13/ps7now-update-notifications/

Destinydestitute answered 19/3, 2021 at 3:11 Comment(1)
Yeah. adding this env variable in profile not works for me on MacOS. anyone else found a solution?Brookite

© 2022 - 2024 — McMap. All rights reserved.