Skip to content

PowerShell ignoring telemetry opt-out options, tries to call home regularly #10005

Closed

Description

I've set a number of OPT-OUT (optout? OPTOUT?) options, since i'm not sure which method is the proper one - your documentation is saying different things at different locations, and the installer, the installer says otherwise, i'm not wisers. Am I suppose to set the OPT-OUT in the user 'scope'? If the OPT-OUT var is set in the 'Machine' scope - does pwsh.exe ignores it or is the Machine Scope super-seeding User scope? Docs don't mention anything at all.

Despite setting all the variants of the opt-out env variables by running snippet in pwsh 6.2.1 and 7.0.0.p1 (built-in Administrator account, Win10 Pro build 10.0.18922.1000 ) I still got repeated connection request to MS servers which I did not approved nor was I asked about it (for users who don't filter traffic they won't even know about it)

That being said, why is it trying to connect randomly for god-knows-what every few minutes? Behaviour happens on launch / exit of pwsh.exe session - 3 times during the write of this text. Privacy being the marketing word lately in MS, but no one seems to clarify what actually is being send to where and for what - just don't drag me into the discussion about the needs of telemetry because I dont need it.

req1

req2

[System.Environment]::SetEnvironmentVariable('POWERSHELL_CLI_TELEMETRY_OPTOUT',1,'User');[System.Environment]::SetEnvironmentVariable('POWERSHELL_TELEMETRY_OPTOUT',1,'User');[System.Environment]::SetEnvironmentVariable('DOTNET_CLI_TELEMETRY_OPTOUT',1,'User');[System.Environment]::SetEnvironmentVariable('DOTNET_TELEMETRY_OPTOUT',1,'User');[System.Environment]::SetEnvironmentVariable('POWERSHELL_CLI_TELEMETRY_OPTOUT',1,'Machine');[System.Environment]::SetEnvironmentVariable('POWERSHELL_TELEMETRY_OPTOUT',1,'Machine');[System.Environment]::SetEnvironmentVariable('DOTNET_CLI_TELEMETRY_OPTOUT',1,'Machine');[System.Environment]::SetEnvironmentVariable('DOTNET_TELEMETRY_OPTOUT',1,'Machine')

Activity

  1. added
    Issue-Question
    on Jun 25, 2019
  2. iSazonov commented on Jun 26, 2019

    @iSazonov
    Collaborator

    inoperable (@inoperable) Could you create a simple dotnet core application and try to catch the commenctions? It helps us understand where root of the issue is - in .Net Core runtime or in PowerShell.

    Travis Plunk (@TravisEz13) Perhaps you could help with the issue?

  3. iSazonov commented on Jun 26, 2019

    @iSazonov
    Collaborator

    The IP addresses (13.69.65.22 and 40.114.241.141) is in the list https://docs.microsoft.com/bs-latn-ba/azure/azure-monitor/app/ip-addresses but both PowerShell and .Net Core can use applicationinsights.

  4. added
    WG-Engine
    on Jun 26, 2019
  5. inoperable commented on Jun 26, 2019

    @inoperable
    Author

    This is all fine and dandy, but this shouldn't be the case - this makes the whole telemetry optout option just a superstitious move. How do you differentate between telemetry and appinsights?

    How does it relate to the POWERSHELL_TELEMETRY_OPTOUT. I thought the whole point of the option is to make any such connections impossible - or am I missing something.

  6. inoperable commented on Jun 26, 2019

    @inoperable
    Author

    ENV VARIABLES below, as you can see, both are set - for user and system (DOTNET_CLI... and DOTNET... as well which can't be seen here) - all mentioned OPTOUT combinations I've found are set - so it can't be that the variable is missing.
    env

  7. inoperable commented on Jun 26, 2019

    @inoperable
    Author

    inoperable (@inoperable) Could you create a simple dotnet core application and try to catch the commenctions? It helps us understand where root of the issue is - in .Net Core runtime or in PowerShell.

    Thank you for your answer - I dodn't have any dotnet sdk installed (yet). I simply add those OPTOUT options by default on every test machine to reduce noise. It is clearly the AppInsights silent optin - I went through your IP list and crossreferenced some of the ip's with my logs. Might also I just missed some smallprint somewhere but I don't remember any AppInsights part during installation.

    Seriously, the only consistant thing is the missuse of the word telemetry across all MS products where one should write user data collection or spyware in short. So what's next APPINSIGHTS_TELEMETRY_OPTOUT?

  8. iSazonov commented on Jun 26, 2019

    @iSazonov
    Collaborator

    How do you differentate between telemetry and appinsights?

    Microsoft.ApplicationInsights is an API for telemetry. PowerShell and Core uses the API. POWERSHELL_TELEMETRY_OPTOUT=1 disables sending a telemetry in PowerShell Core.

  9. TravisEz13 commented on Jun 26, 2019

    @TravisEz13
    Member

    It looks like you did not used the wrong environment variable name. See #10005 (comment)

  10. inoperable commented on Jun 26, 2019

    @inoperable
    Author

    It looks like you did not used the wrong environment variable name. See #10005 (comment)

    I don't understand entirely what you mean - as you can see in the screenshots above, I did used the right variable name, I actually used it twice.

  11. TravisEz13 commented on Jun 26, 2019

    @TravisEz13
    Member

    POWERSHELL_TELEMETRY_OPTOUT must be defined before you start PowerShell.

    Perhaps something other than PowerShell is sending this telemetry.

  12. inoperable commented on Jun 27, 2019

    @inoperable
    Author

    As you can see in the screenshots I posted - it's definitly pwsh.exe process that is initializing the connection. It's not some unknown process, nor can there be any other process - I'm quite sure about it.

    UPDATE: I just run the same on a clean VM installed Windows 10 / Powershell Core installation and with the variables set BEFORE. This aside, does this mean that after first-run it Powershell ignore those variable afterwards?

    The issue is not solved. I can repeat that behaviour. It seems that Powershell does indeed ignore thoses variables.

  13. rkeithhill commented on Jun 27, 2019

    @rkeithhill
    Collaborator

    Try setting DOTNET_CLI_TELEMETRY_OPTOUT to 1 as well. Doesn't matter whether you do it in a system or user environment variable. Just make sure you new pwsh.exe console registers the values correctly i.e. make sure these output 1:

    $env:DOTNET_CLI_TELEMETRY_OPTOUT
    $env:POWERSHELL_TELEMETRY_OPTOUT
    
  14. rkeithhill commented on Jun 27, 2019

    @rkeithhill
    Collaborator

    BTW the nice thing about open source is you can look yourself to see where the telemetry is being sent:

    private static void SendTelemetry(string eventName, Dictionary<string, string> payload)
    {
    try
    {
    var enabled = !GetEnvironmentVariableAsBool(name: TelemetryOptoutEnvVar, defaultValue: false);
    if (!enabled)
    {
    return;
    }
    if (_telemetryClient == null)
    {
    _telemetryClient = new TelemetryClient();
    }
    _telemetryClient.TrackEvent(eventName, payload, null);
    }
    catch (Exception)
    {
    ; // Do nothing, telemetry can't be sent
    }
    }

    The logic is a bit odd. I wish the variable on line 71 was called optOut without the negation and then the if check on line 73 wouldn't also require negation. But it does look correct.

  15. inoperable commented on Jun 27, 2019

    @inoperable
    Author

    C:\Users\Administrator>pwsh
    PowerShell 7.0.0-preview.1
    Copyright (c) Microsoft Corporation. All rights reserved.

    https://aka.ms/pscore6-docs
    Type 'help' to get help.
    
    PS C:\Users\Administrator> [System.Environment]::GetEnvironmentVariable('POWERSHELL_TELEMETRY_OPTOUT')
    1
    PS C:\Users\Administrator> [System.Environment]::GetEnvironmentVariable('DOTNET_TELEMETRY_OPTOUT')
    1
    PS C:\Users\Administrator> [System.Environment]::GetEnvironmentVariable('DOTNET_CLI_TELEMETRY_OPTOUT')
    1
    PS C:\Users\Administrator> [System.Environment]::GetEnvironmentVariable('POWERSHELL_CLI_TELEMETRY_OPTOUT')
    1
    
    

    Keith Hill (@rkeithhill) Keith, thank you for pointing out the relevant function, can patch that function to be sure but still It does not make any sense - you can see that all of those variables are set in my first post - by simply running the snippet you can verify that they are set properly in Machine and User scopes, yet those are obviously either ignored or not read for some reason.

    Could it have something to do with the fact of using the built-in Administrator account instead of the usual one? I would happily patch it and be over it but the build process is - complicated - at least.
    Not else comes to mind (yet)

    Like written before,, see my first post- I've set 8 different variables in total... and it still does send telemetry - that's why I posted here in the first place. Double checked once again. DOTNET_... shouldn't even be there since that variable is not in function you've mentioned but I've set all kind of combinations to be sure (the documentation is not really clear about it and the whole discussion here proves it)

  16. rkeithhill commented on Jun 27, 2019

    @rkeithhill
    Collaborator

    RE DOTNET_CLI_TELEMETRY_OPTOUT PowerShell Core runs on top of .NET Core. So that code base would have the code to disable their telemetry. That said, you're opting out of that telemetry too.

    It is possible it is another MS shared library (or PowerShell module) that is sending the telemetry. PowerShell does run in a conhost.exe instance. Do you see these connections if you fire up cmd.exe? That would rule out conhost.exe (since cmd.exe also uses it). There is active development going on with conhost right now. Maybe they're looking for telemetry on usage?

  17. inoperable commented on Jun 27, 2019

    @inoperable
    Author

    Keith Hill (@rkeithhill) I can't find any requests from conhost.exe in the log, never seen one directly from cmd.exe either. This happens exclusiely when pwsh.exe, 6.2.1 and 7.0.0.p1 is runnig - I'm gonna run it through xdbg64 and see if I can nail it down.

  18. iSazonov commented on Jun 27, 2019

    @iSazonov
    Collaborator

    I still got repeated connection request to MS servers

    PowerShell Core sends the telemetry only at startup. So it is not POwerSHell issue. Root cause could be in ApplicationInsights or in .Net Core, or another process.
    Debugging will help you.

  19. TravisEz13 commented on Jun 27, 2019

    @TravisEz13
    Member

    The variable MUST be set in the environment BEFORE the process is start as it read at startup.

    Again, Please use the issue template and provide a complete repro. I really don't understand what you are trying to say the problem is here. You asked as question. The question has been answered and this issue is resolved.

    If you would like us to treat this like an issue, fill out the complete issue template with the full steps required to reproduce the issue.

    But, if I understand you correctly, you have a feature request, which is to recognize that you don't want telemetry to be sent after the process is started. If that is the case, please use the feature request template.

  20. ghost closed this as completedon Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-QuestionResolution-AnsweredWG-Engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions