Ver código fonte

📰 Update off_telemetry_ps5_win7+.ps1

VLADYSLAV BOBER 11 meses atrás
pai
commit
ac23f0e91e
1 arquivos alterados com 33 adições e 94 exclusões
  1. 33 94
      script/off_telemetry_ps5_win7+.ps1

+ 33 - 94
script/off_telemetry_ps5_win7+.ps1

@@ -845,139 +845,78 @@ Write-Host "Telemetry Directories Cleanup" -ForegroundColor $Colors.Success
 # =======================================================
 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 :" -ForegroundColor $Colors.Info
-Write-Host "  - INTELLICODE_TELEMETRY_OPTOUT" -ForegroundColor $Colors.Info
-Write-Host "  - LIVESHARE_TELEMETRY_OPTOUT" -ForegroundColor $Colors.Info
-Write-Host "  - 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) {
+if ($installedVersions.Count -eq 0) {
+    Write-Host "[SKIP] No Visual Studio installations detected – skipping additional configuration" -ForegroundColor $Colors.Gray
+} else {
+    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 :" -ForegroundColor $Colors.Info
+    Write-Host "  - INTELLICODE_TELEMETRY_OPTOUT" -ForegroundColor $Colors.Info
+    Write-Host "  - LIVESHARE_TELEMETRY_OPTOUT" -ForegroundColor $Colors.Info
+    Write-Host "  - VSSDK_TELEMETRY_OPTOUT" -ForegroundColor $Colors.Info
+
+    $enableAdditional = Read-Host "`nEnable additional configuration? (y/n)"
+
+    if ($enableAdditional -match '^y(es)?$') {
+        # === START: Disabling Additional Visual Studio Features ===
+
+        Write-Host "`n--- Disabling Additional Visual Studio Features ---" -ForegroundColor $Colors.Section
+
         foreach ($version in $installedVersions) {
             $vsName = $vsVersions[$version]
             Write-Host "`n--- Processing Additional Features for $vsName (version $version) ---" -ForegroundColor $Colors.Info
-            
-            # =======================================================
-            # SETTINGS SYNCHRONIZATION
-            # =======================================================
-            Write-Host "[INFO] Disabling Settings Synchronization..." -ForegroundColor $Colors.Info
-            
+
+            # Settings Sync
             $settingsPaths = @(
                 "HKCU:\Software\Microsoft\VisualStudio\$version\Settings",
                 "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\Settings"
             )
-            
             foreach ($path in $settingsPaths) {
                 $null = Set-SafeRegistryValue -Path $path -Name "SyncSettings" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "EnableRoaming" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "EnableSync" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "DisableSync" -Value 1 -Type 'DWORD' -CreatePath
             }
-            
-            # Additional settings sync paths
-            $syncPath = "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\ConnectedServices"
-            $null = Set-SafeRegistryValue -Path $syncPath -Name "Provider.Enabled" -Value 0 -Type 'DWORD' -CreatePath
-            
-            # =======================================================
-            # LIVE SHARE
-            # =======================================================
-            Write-Host "[INFO] Disabling Live Share..." -ForegroundColor $Colors.Info
-            
+
+            # Live Share
             $liveSharePaths = @(
                 "HKCU:\Software\Microsoft\VisualStudio\$version\LiveShare",
                 "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\LiveShare"
             )
-            
             foreach ($path in $liveSharePaths) {
-                $null = Set-SafeRegistryValue -Path $path -Name "Enabled" -Value 0 -Type 'DWORD' -CreatePath
                 $null = Set-SafeRegistryValue -Path $path -Name "EnableTelemetry" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "DisableTelemetry" -Value 1 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "OptedIn" -Value 0 -Type 'DWORD' -CreatePath
             }
-            
-            # Live Share telemetry
-            $liveShareTelemetryPath = "HKCU:\Software\Microsoft\VisualStudio\$version\LiveShare\Telemetry"
-            $null = Set-SafeRegistryValue -Path $liveShareTelemetryPath -Name "Enabled" -Value 0 -Type 'DWORD' -CreatePath
-            $null = Set-SafeRegistryValue -Path $liveShareTelemetryPath -Name "OptOut" -Value 1 -Type 'DWORD' -CreatePath
-            
-            # =======================================================
-            # INTELLICODE
-            # =======================================================
-            Write-Host "[INFO] Disabling IntelliCode..." -ForegroundColor $Colors.Info
-            
+
+            # IntelliCode
             $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) {
-                $null = Set-SafeRegistryValue -Path $path -Name "DisableTelemetry" -Value 1 -Type 'DWORD' -CreatePath
                 $null = Set-SafeRegistryValue -Path $path -Name "EnableTelemetry" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "OptedIn" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "Enabled" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "ModelDownloadEnabled" -Value 0 -Type 'DWORD' -CreatePath
             }
-            
-            # IntelliCode privacy settings
-            $intelliCodePrivacyPath = "HKCU:\Software\Microsoft\VisualStudio\$version\IntelliCode\Privacy"
-            $null = Set-SafeRegistryValue -Path $intelliCodePrivacyPath -Name "TelemetryOptOut" -Value 1 -Type 'DWORD' -CreatePath
-            $null = Set-SafeRegistryValue -Path $intelliCodePrivacyPath -Name "DataCollection" -Value 0 -Type 'DWORD' -CreatePath
-            $null = Set-SafeRegistryValue -Path $intelliCodePrivacyPath -Name "UsageDataOptOut" -Value 1 -Type 'DWORD' -CreatePath
-            
-            # =======================================================
-            # CODELENS
-            # =======================================================
-            Write-Host "[INFO] Disabling CodeLens..." -ForegroundColor $Colors.Info
-            
+
+            # CodeLens
             $codeLensPaths = @(
                 "HKCU:\Software\Microsoft\VisualStudio\$version\CodeLens",
-                "HKCU:\Software\Microsoft\VisualStudio\$version\TextEditor\CodeLens",
-                "HKCU:\Software\Microsoft\VisualStudio\$version\ApplicationPrivateSettings\Microsoft\VisualStudio\CodeLens"
+                "HKCU:\Software\Microsoft\VisualStudio\$version\TextEditor\CodeLens"
             )
-            
             foreach ($path in $codeLensPaths) {
-                $null = Set-SafeRegistryValue -Path $path -Name "Disabled" -Value 1 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "ShowAuthorCodeLens" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "ShowReferencesCodeLens" -Value 0 -Type 'DWORD' -CreatePath
-                $null = Set-SafeRegistryValue -Path $path -Name "ShowTestCodeLens" -Value 0 -Type 'DWORD' -CreatePath
                 $null = Set-SafeRegistryValue -Path $path -Name "Enabled" -Value 0 -Type 'DWORD' -CreatePath
             }
-            
-            # CodeLens telemetry
-            $codeLensTelemetryPath = "HKCU:\Software\Microsoft\VisualStudio\$version\CodeLens\Telemetry"
-            $null = Set-SafeRegistryValue -Path $codeLensTelemetryPath -Name "Enabled" -Value 0 -Type 'DWORD' -CreatePath
-            $null = Set-SafeRegistryValue -Path $codeLensTelemetryPath -Name "OptOut" -Value 1 -Type 'DWORD' -CreatePath
-        }
-        } else {
-            Write-Host "[SKIP] No Visual Studio installations detected, skipping additional features" -ForegroundColor $Colors.Gray
         }
-        
-        # =======================================================
-        # ADDITIONAL ENVIRONMENT VARIABLES
-        # =======================================================
+
+        # Environment variables
         Write-Host "`n--- Setting Additional Environment Variables ---" -ForegroundColor $Colors.Section
-        
         $null = Set-SafeEnvironmentVariable -Name 'INTELLICODE_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
         $null = Set-SafeEnvironmentVariable -Name 'LIVESHARE_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
         $null = Set-SafeEnvironmentVariable -Name 'VSSDK_TELEMETRY_OPTOUT' -Value '1' -Target 'User'
-        
+
         Write-Host "`n[OK] Additional configuration completed" -ForegroundColor $Colors.Success
     } else {
         Write-Host "[SKIP] Skipping additional configuration" -ForegroundColor $Colors.Info
     }
+}
 
 Write-Host "`nLegend:" -ForegroundColor White
 Write-Host "[OK] " -NoNewline -ForegroundColor $Colors.Success; Write-Host "Action completed successfully"