microsoft / winget-pkgs

The Microsoft community Windows Package Manager manifest repository
MIT License
8.53k stars 4.43k forks source link

[Package Issue]: Microsoft.PowerShell GDPR consent problem: telemetry is forcefully enabled on either install or upgrade (even if it was already disabled) #149014

Closed R-Adrian closed 4 months ago

R-Adrian commented 5 months ago

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

Actual behavior

Expected behavior

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: PowerShell 7.4.1 installation with telemetry disabled

checking before upgrade... pwsh_741_before_upgrade

and running winget upgrade Microsoft.PowerShell (using the old Windows PowerShell instead of cmd.exe as a console window)

pwsh_742_winget_upgrade_

... PowerShell 7 telemetry optout is now disabled and the variable is not defined anymore - this means that telemetry was forcefully enabled during the upgrade.

pwsh_742_after_upgrade

Trenly commented 5 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?

R-Adrian commented 5 months ago

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.

https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4

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:

/quotes

Trenly commented 5 months ago

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.

https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.4

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

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

StevenBucher98 commented 5 months ago

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

anamnavi commented 5 months ago

@R-Adrian thanks for creating this issue. The following PR may address the issue: https://github.com/PowerShell/PowerShell/pull/20420

StevenBucher98 commented 5 months ago

A work around is to do winget upgrade Microsoft.PowerShell --interactive to open up the MSI installer GUI again to reset the settings.

microsoft-github-policy-service[bot] commented 4 months ago

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