Closed R-Adrian closed 4 months ago
@cinnamon-msft / @denelon - This seems like it might be more an issue with the PowerShell installer than with WinGet?
@denelon - Do Agreements
need to be added to the manifest for GDPR?
This seems like it might be more an issue with the PowerShell installer than with WinGet?
The PowerShell 7 MSI installer supports parameters equivalent to those checkboxes during the manual installation... but the installer does not seem to preserve the install settings from the previous version when upgrading, so IMHO it falls to WinGet to pass the appropriate parameters to the installer, especially since Microsoft recommends the use of WinGet to handle both the initial installation or the upgrades of PowerShell 7. Handling the initial installation means WinGet has to handle obtaining the telemetry tracking consent too, but such consent must not be a mandatory condition to the installation of the application.
quotes from that page: Install PowerShell using Winget (recommended) Winget, the Windows Package Manager, is a command-line tool enables users to discover, install, upgrade, remove, and configure applications on Windows client computers. This tool is the client interface to the Windows Package Manager service. The winget command-line tool is bundled with Windows 11 and modern versions of Windows 10 by default as the App Installer. [...snip...]
Install the MSI package from the command line MSI packages can be installed from the command line allowing administrators to deploy packages without user interaction. The MSI package includes the following properties to control the installation options:
ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL
- This property controls the option for adding the Open PowerShell item to the context menu in Windows Explorer.ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL
- This property controls the option for adding the Run with PowerShell item to the context menu in Windows Explorer.ENABLE_PSREMOTING
- This property controls the option for enabling PowerShell remoting during installation.REGISTER_MANIFEST
- This property controls the option for registering the Windows Event Logging manifest.ADD_PATH
- This property controls the option for adding PowerShell to the Windows PATH environment variable.DISABLE_TELEMETRY
- This property controls the option for disabling PowerShell's telemetry by setting the POWERSHELL_TELEMETRY_OPTOUT
environment variable.INSTALLFOLDER
- This property controls the installation directory. The default is $env:ProgramFiles\PowerShell. This is the location where the installer creates the versioned subfolder. You can't change the name of the versioned subfolder. For current releases, the versioned subfolder is 7
/quotes
This seems like it might be more an issue with the PowerShell installer than with WinGet?
The PowerShell 7 MSI installer supports parameters equivalent to those checkboxes during the manual installation... but the installer does not seem to preserve the install settings from the previous version when upgrading, so IMHO it falls to WinGet to pass the appropriate parameters to the installer, especially since Microsoft recommends the use of WinGet to handle both the initial installation or the upgrades of PowerShell 7. Handling the initial installation means WinGet has to handle obtaining the telemetry tracking consent too, but such consent must not be a mandatory condition to the installation of the application.
quotes from that page: Install PowerShell using Winget (recommended) Winget, the Windows Package Manager, is a command-line tool enables users to discover, install, upgrade, remove, and configure applications on Windows client computers. This tool is the client interface to the Windows Package Manager service. The winget command-line tool is bundled with Windows 11 and modern versions of Windows 10 by default as the App Installer. [...snip...]
Install the MSI package from the command line MSI packages can be installed from the command line allowing administrators to deploy packages without user interaction. The MSI package includes the following properties to control the installation options:
ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL
- This property controls the option for adding the Open PowerShell item to the context menu in Windows Explorer.ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL
- This property controls the option for adding the Run with PowerShell item to the context menu in Windows Explorer.ENABLE_PSREMOTING
- This property controls the option for enabling PowerShell remoting during installation.REGISTER_MANIFEST
- This property controls the option for registering the Windows Event Logging manifest.ADD_PATH
- This property controls the option for adding PowerShell to the Windows PATH environment variable.DISABLE_TELEMETRY
- This property controls the option for disabling PowerShell's telemetry by setting thePOWERSHELL_TELEMETRY_OPTOUT
environment variable.INSTALLFOLDER
- This property controls the installation directory. The default is $env:ProgramFiles\PowerShell. This is the location where the installer creates the versioned subfolder. You can't change the name of the versioned subfolder. For current releases, the versioned subfolder is7
/quotes
Fundamentally all WinGet does is download and run the installer. There is no way for WinGet to know what settings a user previously installed with, especially if PowerShell was installed oustide of WinGet.
If you were to download the MSI and run it from the commandline with the /qn
switch you would see the same behavior where the telemetry option is reset on a new instal or upgrade.
Yes, it is true that WinGet can pass some pre-defined switches to installers, but they are generally applied to every install. Either way, WinGet wouldn’t be able to detect the application level setting and change its behavior based on that. Therefore, it really needs to be the PowerShell installer that (when running unattended) checks for previous install settings and respects them
So I was working on reproduction and reproduced it for winget, had same MSI and did winget install via cmd.exe but in same cmd.exe session launched pwsh.exe and was on 7.4.2 and $env:POWERSHELL_TELEMETRY_OPTOUT
was 1 in that session but when I closed that and reopened PS7 it was no longer set.
Still investigating
@R-Adrian thanks for creating this issue. The following PR may address the issue: https://github.com/PowerShell/PowerShell/pull/20420
A work around is to do winget upgrade Microsoft.PowerShell --interactive
to open up the MSI installer GUI again to reset the settings.
Hello @R-Adrian,
This issue has been identified as requiring a fix from a third party or external repository. Since there has been no recent activity on this issue, it will be automatically closed.
Template: msftbot/noRecentActivity/areaExternal
Please confirm these before moving forward
Category of the issue
Installation issue.
Brief description of your issue
Microsoft.PowerShell 7 (currently at v7.4.2) forcefully enables telemetry for either initial installation via winget or for updates.
Steps to reproduce
related PowerShell issue: https://github.com/PowerShell/PowerShell/issues/21467
https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/PowerShell-7.4.1-win-x64.msi
)$env:POWERSHELL_TELEMETRY_OPTOUT
environment variable (it shows 1 in my case)winget upgrade Microsoft.PowerShell
- and update pwsh to version 7.4.2 (https://github.com/PowerShell/PowerShell/releases/download/v7.4.2/PowerShell-7.4.2-win-x64.msi
)$env:POWERSHELL_TELEMETRY_OPTOUT
environment variable again - after the winget silent/unattended update it shows no optout (i.e. the telemetry is now forcefully enabled again)Actual behavior
winget install Microsoft.PowerShell
, PowerShell 7 telemetry is forcefully enabled (default state) without any explicit consent requested or given about it.Expected behavior
when upgrading - the telemetry optout preference should be preserved, not wiped as it does now.
when installing - in Europe (GDPR) - the telemetry should probably default to off (passed via the
DISABLE_TELEMETRY
MSI installer flag) as required by Article 6 of the GDPR.Environment
(environment not relevant - this is an issue with the MSI installer and the parameters passed by the winget package manager to it)
Screenshots and Logs
PowerShell telemetry reference: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_telemetry?view=powershell-7.4
PowerShell 7.4.1 manual installation of the MSI file, with telemetry disabled:
checking before upgrade...
and running
winget upgrade Microsoft.PowerShell
(using the old Windows PowerShell instead of cmd.exe as a console window)... PowerShell 7 telemetry optout is now disabled and the variable is not defined anymore - this means that telemetry was forcefully enabled during the upgrade.