Skip to content

Instantly share code, notes, and snippets.

@maokwen
Created April 20, 2023 15:08
Show Gist options
  • Select an option

  • Save maokwen/dcfee7d739eb586e55abd9954daeda9e to your computer and use it in GitHub Desktop.

Select an option

Save maokwen/dcfee7d739eb586e55abd9954daeda9e to your computer and use it in GitHub Desktop.
$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