Repository navigation
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.
[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
iSazonov commentedon Jun 26, 2019
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?
iSazonov commentedon Jun 26, 2019
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.
inoperable commentedon Jun 26, 2019
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.
inoperable commentedon Jun 26, 2019
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.

inoperable commentedon Jun 26, 2019
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?
iSazonov commentedon Jun 26, 2019
Microsoft.ApplicationInsights is an API for telemetry. PowerShell and Core uses the API. POWERSHELL_TELEMETRY_OPTOUT=1 disables sending a telemetry in PowerShell Core.
TravisEz13 commentedon Jun 26, 2019
It looks like you did not used the wrong environment variable name. See #10005 (comment)
inoperable commentedon Jun 26, 2019
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.
TravisEz13 commentedon Jun 26, 2019
POWERSHELL_TELEMETRY_OPTOUTmust be defined before you start PowerShell.Perhaps something other than PowerShell is sending this telemetry.
inoperable commentedon Jun 27, 2019
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.
rkeithhill commentedon Jun 27, 2019
Try setting
DOTNET_CLI_TELEMETRY_OPTOUTto1as 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:rkeithhill commentedon Jun 27, 2019
BTW the nice thing about open source is you can look yourself to see where the telemetry is being sent:
PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/Telemetry.cs
Lines 67 to 89 in bd6fdae
The logic is a bit odd. I wish the variable on line 71 was called
optOutwithout the negation and then theifcheck on line 73 wouldn't also require negation. But it does look correct.inoperable commentedon Jun 27, 2019
C:\Users\Administrator>pwsh
PowerShell 7.0.0-preview.1
Copyright (c) Microsoft Corporation. All rights reserved.
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
MachineandUserscopes, 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)
rkeithhill commentedon Jun 27, 2019
RE
DOTNET_CLI_TELEMETRY_OPTOUTPowerShell 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?
inoperable commentedon Jun 27, 2019
Keith Hill (@rkeithhill) I can't find any requests from
conhost.exein the log, never seen one directly fromcmd.exeeither. This happens exclusiely whenpwsh.exe,6.2.1and7.0.0.p1is runnig - I'm gonna run it throughxdbg64and see if I can nail it down.iSazonov commentedon Jun 27, 2019
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.
TravisEz13 commentedon Jun 27, 2019
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.