Просмотр исходного кода

📰 Update to 1.0.1

Additional Visual Studio Features (Y/N)

Settings Synchronization - Disable cloud sync
Live Share - Complete telemetry disable
IntelliCode - AI-based telemetry opt-out
CodeLens - Feature disable with telemetry

Extended Environment Variables

INTELLICODE_TELEMETRY_OPTOUT=1
LIVESHARE_TELEMETRY_OPTOUT=1
VSSDK_TELEMETRY_OPTOUT=1
VLADYSLAV BOBER 11 месяцев назад
Родитель
Сommit
2cbea07e3d
1 измененных файлов с 137 добавлено и 5 удалено
  1. 137 5
      script/off_telemetry_ps7.ps1

+ 137 - 5
script/off_telemetry_ps7.ps1

@@ -1,8 +1,5 @@
 using namespace System.Collections.Generic
 
-#Requires -RunAsAdministrator
-#Requires -Version 7.0
-
 <#
 .SYNOPSIS
     Enhanced comprehensive script to disable telemetry in Microsoft development tools with backup/restore functionality
@@ -699,13 +696,148 @@ Write-Host "✓ " -NoNewline -ForegroundColor $Colors.Success
 Write-Host "Telemetry Directories Cleanup " -NoNewline -ForegroundColor $Colors.Info
 Write-Host "(processed)" -ForegroundColor $Colors.Success
 
+# =======================================================
+# ADDITIONAL FEATURES AND ENVIRONMENT VARIABLES
+# =======================================================
+Write-Host "`n--- Optional: Additional Features and Environment Variables ---" -ForegroundColor $Colors.Section
+
+Write-Host "This will perform additional configuration:" -ForegroundColor $Colors.Info
+Write-Host "• Disable Visual Studio Settings Synchronization" -ForegroundColor $Colors.Info
+Write-Host "• Disable Live Share" -ForegroundColor $Colors.Info
+Write-Host "• Disable IntelliCode" -ForegroundColor $Colors.Info
+Write-Host "• Disable CodeLens" -ForegroundColor $Colors.Info
+Write-Host "• Set additional environment variables (INTELLICODE_TELEMETRY_OPTOUT, LIVESHARE_TELEMETRY_OPTOUT, VSSDK_TELEMETRY_OPTOUT)" -ForegroundColor $Colors.Info
+
+$enableAdditional = Read-Host "`nEnable additional configuration? (y/n)"
+
+if ($enableAdditional -eq 'y' -or $enableAdditional -eq 'Y' -or $enableAdditional -eq 'yes' -or $enableAdditional -eq 'Yes' -or $enableAdditional -eq 'YES') {
+    
+    # =======================================================
+    # VISUAL STUDIO ADDITIONAL FEATURES DISABLE
+    # =======================================================
+    Write-Host "`n--- Disabling Additional Visual Studio Features ---" -ForegroundColor $Colors.Section
+    
+    if ($installedVersions.Count -gt 0) {
+        foreach ($version in $installedVersions) {
+            $vsName = $vsVersions[$version]
+            Write-Host "`n--- Processing Additional Features for $vsName (version $version) ---" -ForegroundColor $Colors.Info
+            
+            # =======================================================
+            # SETTINGS SYNCHRONIZATION
+            # =======================================================
+            Write-Host "→ Disabling Settings Synchronization..." -ForegroundColor $Colors.Info
+            
+            $settingsPaths = @(
+                "HKCU:\Software\Microsoft\VisualStudio\$version\Settings",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\Settings"
+            )
+            
+            foreach ($path in $settingsPaths) {
+                Set-RegistryValue -Path $path -Name "SyncSettings" -Value 0
+                Set-RegistryValue -Path $path -Name "EnableRoaming" -Value 0
+                Set-RegistryValue -Path $path -Name "EnableSync" -Value 0
+                Set-RegistryValue -Path $path -Name "DisableSync" -Value 1
+            }
+            
+            # Additional settings sync paths
+            $syncPath = "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\ConnectedServices"
+            Set-RegistryValue -Path $syncPath -Name "Provider.Enabled" -Value 0
+            
+            # =======================================================
+            # LIVE SHARE
+            # =======================================================
+            Write-Host "→ Disabling Live Share..." -ForegroundColor $Colors.Info
+            
+            $liveSharePaths = @(
+                "HKCU:\Software\Microsoft\VisualStudio\$version\LiveShare",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\LiveShare"
+            )
+            
+            foreach ($path in $liveSharePaths) {
+                Set-RegistryValue -Path $path -Name "Enabled" -Value 0
+                Set-RegistryValue -Path $path -Name "EnableTelemetry" -Value 0
+                Set-RegistryValue -Path $path -Name "DisableTelemetry" -Value 1
+                Set-RegistryValue -Path $path -Name "OptedIn" -Value 0
+            }
+            
+            # Live Share telemetry
+            $liveShareTelemetryPath = "HKCU:\Software\Microsoft\VisualStudio\$version\LiveShare\Telemetry"
+            Set-RegistryValue -Path $liveShareTelemetryPath -Name "Enabled" -Value 0
+            Set-RegistryValue -Path $liveShareTelemetryPath -Name "OptOut" -Value 1
+            
+            # =======================================================
+            # INTELLICODE
+            # =======================================================
+            Write-Host "→ Disabling IntelliCode..." -ForegroundColor $Colors.Info
+            
+            $intelliCodePaths = @(
+                "HKCU:\Software\Microsoft\VisualStudio\$version\IntelliCode",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\IntelliSense\IntelliCode",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode"
+            )
+            
+            foreach ($path in $intelliCodePaths) {
+                Set-RegistryValue -Path $path -Name "DisableTelemetry" -Value 1
+                Set-RegistryValue -Path $path -Name "EnableTelemetry" -Value 0
+                Set-RegistryValue -Path $path -Name "OptedIn" -Value 0
+                Set-RegistryValue -Path $path -Name "Enabled" -Value 0
+                Set-RegistryValue -Path $path -Name "ModelDownloadEnabled" -Value 0
+            }
+            
+            # IntelliCode privacy settings
+            $intelliCodePrivacyPath = "HKCU:\Software\Microsoft\VisualStudio\$version\IntelliCode\Privacy"
+            Set-RegistryValue -Path $intelliCodePrivacyPath -Name "TelemetryOptOut" -Value 1
+            Set-RegistryValue -Path $intelliCodePrivacyPath -Name "DataCollection" -Value 0
+            Set-RegistryValue -Path $intelliCodePrivacyPath -Name "UsageDataOptOut" -Value 1
+            
+            # =======================================================
+            # CODELENS
+            # =======================================================
+            Write-Host "→ Disabling CodeLens..." -ForegroundColor $Colors.Info
+            
+            $codeLensPaths = @(
+                "HKCU:\Software\Microsoft\VisualStudio\$version\CodeLens",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\TextEditor\CodeLens",
+                "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\CodeLens"
+            )
+            
+            foreach ($path in $codeLensPaths) {
+                Set-RegistryValue -Path $path -Name "Disabled" -Value 1
+                Set-RegistryValue -Path $path -Name "ShowAuthorCodeLens" -Value 0
+                Set-RegistryValue -Path $path -Name "ShowReferencesCodeLens" -Value 0
+                Set-RegistryValue -Path $path -Name "ShowTestCodeLens" -Value 0
+                Set-RegistryValue -Path $path -Name "Enabled" -Value 0
+            }
+            
+            # CodeLens telemetry
+            $codeLensTelemetryPath = "HKCU:\Software\Microsoft\VisualStudio\$version\CodeLens\Telemetry"
+            Set-RegistryValue -Path $codeLensTelemetryPath -Name "Enabled" -Value 0
+            Set-RegistryValue -Path $codeLensTelemetryPath -Name "OptOut" -Value 1
+        }
+    } else {
+        Write-Host "→ No Visual Studio installations detected, skipping additional features" -ForegroundColor $Colors.Gray
+    }
+    
+    # =======================================================
+    # ADDITIONAL ENVIRONMENT VARIABLES
+    # =======================================================
+    Write-Host "`n--- Setting Additional Environment Variables ---" -ForegroundColor $Colors.Section
+    
+    Set-EnvironmentVariableIfNeeded -Name 'INTELLICODE_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
+    Set-EnvironmentVariableIfNeeded -Name 'LIVESHARE_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
+    Set-EnvironmentVariableIfNeeded -Name 'VSSDK_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
+    
+    Write-Host "`n✓ Additional configuration completed" -ForegroundColor $Colors.Success
+} else {
+    Write-Host "→ Skipping additional configuration" -ForegroundColor $Colors.Info
+}
+
 Write-Host "`nLegend:" -ForegroundColor $Colors.White
 Write-Host "✓ " -NoNewline -ForegroundColor $Colors.Success; Write-Host "Action completed successfully" -ForegroundColor $Colors.Gray
 Write-Host "→ " -NoNewline -ForegroundColor $Colors.Info; Write-Host "Information or preparatory action" -ForegroundColor $Colors.Gray
 Write-Host "→ " -NoNewline -ForegroundColor $Colors.Gray; Write-Host "Component not found or not processed" -ForegroundColor $Colors.Gray
 Write-Host "✗ " -NoNewline -ForegroundColor $Colors.Error; Write-Host "Error occurred" -ForegroundColor $Colors.Gray
 
-
 Write-Host "`nUsage Examples:" -ForegroundColor $Colors.White
 Write-Host "→ " -NoNewline -ForegroundColor $Colors.Info
 Write-Host "Create backup first: " -NoNewline -ForegroundColor $Colors.White
@@ -725,4 +857,4 @@ if (!$CreateBackup) {
 Write-Host "`n⚠ " -NoNewline -ForegroundColor $Colors.Warning
 Write-Host "Restart may be required for all changes to take effect." -ForegroundColor $Colors.Warning
 Write-Host "`nPress Enter to exit..." -ForegroundColor $Colors.White
-$null = Read-Host
+$null = Read-Host