Created
April 20, 2023 15:08
-
-
Save maokwen/dcfee7d739eb586e55abd9954daeda9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $variables = [ordered]@{ | |
| POWERSHELL_CLI_TELEMETRY_OPTOUT = "1" | |
| POWERSHELL_TELEMETRY_OPTOUT = "1" | |
| POWERSHELL_UPDATECHECK = "Off" | |
| POWERSHELL_UPDATECHECK_OPTOUT = "1" | |
| DOTNET_CLI_TELEMETRY_OPTOUT = "1" | |
| DOTNET_TELEMETRY_OPTOUT = "1" | |
| } | |
| foreach ($target in "User","Machine") { | |
| write-Host "Target: $target" -foregroundcolor cyan | |
| foreach ($key in $variables.Keys) { | |
| write-Host " $key = $($variables.$Key)" | |
| [Environment]::SetEnvironmentVariable($key,$variables.$Key, $target) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment