<# .SYNOPSIS Sophia Script is a PowerShell module for fine-tuning Windows and automating routine tasks .VERSION 7.1.4 .DATE 24.02.2026 .COPYRIGHT (c) 2014—2026 Team Sophia .NOTES Supports Windows 11 24H2+ Home/Pro/Enterprise .LINK GitHub https://github.com/farag2/Sophia-Script-for-Windows .LINK Telegram https://t.me/sophianews https://t.me/sophia_chat .LINK Discord https://discord.gg/sSryhaEv79 .DONATE https://ko-fi.com/farag https://boosty.to/teamsophia .NOTES https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 https://habr.com/companies/skillfactory/articles/553800/ https://forums.mydigitallife.net/threads/powershell-sophia-script-for-windows-6-0-4-7-0-4-2026.81675/page-21 https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ .LINK https://github.com/farag2 https://github.com/Inestic https://github.com/lowl1f3 #> #region Protection # Enable script logging. The log will be being recorded into the script root folder # To stop logging just close the console or type "Stop-Transcript" function Logging { $TranscriptFilename = "Log-$((Get-Date).ToString("dd.MM.yyyy-HH-mm"))" Start-Transcript -Path $PSScriptRoot\..\$TranscriptFilename.txt -Force } # Create a restore point for the system drive function CreateRestorePoint { # Check if system protection is turned on $SystemDriveUniqueID = (Get-Volume | Where-Object -FilterScript {$_.DriveLetter -eq "$($env:SystemDrive[0])"}).UniqueID $SystemProtection = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients" -ErrorAction Ignore)."{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}") | Where-Object -FilterScript {$_ -match [regex]::Escape($SystemDriveUniqueID)} $Global:ComputerRestorePoint = $false # System protection is turned off if (-not $SystemProtection) { # Turn it on for a while $Global:ComputerRestorePoint = $true Enable-ComputerRestore -Drive $env:SystemDrive } # Never skip creating a restore point New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name SystemRestorePointCreationFrequency -PropertyType DWord -Value 0 -Force Checkpoint-Computer -Description "Sophia Script for Windows 11" -RestorePointType MODIFY_SETTINGS # Revert the System Restore checkpoint creation frequency to 1440 minutes New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name SystemRestorePointCreationFrequency -PropertyType DWord -Value 1440 -Force # Turn off System Protection for the system drive if it was turned off before without deleting the existing restore points if ($Global:ComputerRestorePoint) { Disable-ComputerRestore -Drive $env:SystemDrive } } #endregion Protection #region Privacy & Telemetry <# .SYNOPSIS The Connected User Experiences and Telemetry (DiagTrack) service .PARAMETER Disable Disable the Connected User Experiences and Telemetry (DiagTrack) service, and block connection for the Unified Telemetry Client Outbound Traffic .PARAMETER Enable Enable the Connected User Experiences and Telemetry (DiagTrack) service, and allow connection for the Unified Telemetry Client Outbound Traffic .EXAMPLE DiagTrackService -Disable .EXAMPLE DiagTrackService -Enable .NOTES Disabling the "Connected User Experiences and Telemetry" service (DiagTrack) can cause you not being able to get Xbox achievements anymore and affects Feedback Hub .NOTES Current user #> function DiagTrackService { param ( [Parameter( Mandatory = $true, ParameterSetName = "Disable" )] [switch] $Disable, [Parameter( Mandatory = $true, ParameterSetName = "Enable" )] [switch] $Enable ) switch ($PSCmdlet.ParameterSetName) { "Disable" { # Connected User Experiences and Telemetry # Disabling the "Connected User Experiences and Telemetry" service (DiagTrack) can cause you not being able to get Xbox achievements anymore and affects Feedback Hub Get-Service -Name DiagTrack -ErrorAction Ignore | Stop-Service -Force Get-Service -Name DiagTrack -ErrorAction Ignore | Set-Service -StartupType Disabled # Block connection for the Unified Telemetry Client Outbound Traffic Get-NetFirewallRule -Group DiagTrack -ErrorAction Ignore | Set-NetFirewallRule -Enabled True -Action Block } "Enable" { # Connected User Experiences and Telemetry Get-Service -Name DiagTrack -ErrorAction Ignore | Set-Service -StartupType Automatic Get-Service -Name DiagTrack -ErrorAction Ignore | Start-Service # Allow connection for the Unified Telemetry Client Outbound Traffic Get-NetFirewallRule -Group DiagTrack -ErrorAction Ignore | Set-NetFirewallRule -Enabled True -Action Allow } } } <# .SYNOPSIS Diagnostic data .PARAMETER Minimal Set the diagnostic data collection to minimum .PARAMETER Default Set the diagnostic data collection to default .EXAMPLE DiagnosticDataLevel -Minimal .EXAMPLE DiagnosticDataLevel -Default .NOTES Machine-wide #> function DiagnosticDataLevel { param ( [Parameter( Mandatory = $true, ParameterSetName = "Minimal" )] [switch] $Minimal, [Parameter( Mandatory = $true, ParameterSetName = "Default" )] [switch] $Default ) if (-not (Test-Path -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection)) { New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Force } if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack)) { New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Force } switch ($PSCmdlet.ParameterSetName) { "Minimal" { $EditionID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").EditionID if (($EditionID -match "Enterprise") -or ($EditionID -match "Education")) { # Diagnostic data off New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 0 -Force Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type DWORD -Value 0 } else { # Send required diagnostic data New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 1 -Force Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type DWORD -Value 1 } New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name MaxTelemetryAllowed -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Name ShowedToastAtLevel -PropertyType DWord -Value 1 -Force } "Default" { # Optional diagnostic data New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name MaxTelemetryAllowed -PropertyType DWord -Value 3 -Force New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Name ShowedToastAtLevel -PropertyType DWord -Value 3 -Force Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type CLEAR } } } <# .SYNOPSIS Windows Error Reporting .PARAMETER Disable Turn off Windows Error Reporting .PARAMETER Enable Turn on Windows Error Reporting .EXAMPLE ErrorReporting -Disable .EXAMPLE ErrorReporting -Enable .NOTES Current user #> function ErrorReporting { param ( [Parameter( Mandatory = $true, ParameterSetName = "Disable" )] [switch] $Disable, [Parameter( Mandatory = $true, ParameterSetName = "Enable" )] [switch] $Enable ) # Remove all policies in order to make changes visible in UI Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting", "HKCU:\Software\Policies\Microsoft\Windows\Windows Error Reporting" -Name Disabled -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Error Reporting" -Name Disabled -Type CLEAR Set-Policy -Scope User -Path "Software\Policies\Microsoft\Windows\Windows Error Reporting" -Name Disabled -Type CLEAR switch ($PSCmdlet.ParameterSetName) { "Disable" { Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Disable-ScheduledTask New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -PropertyType DWord -Value 1 -Force Get-Service -Name WerSvc | Stop-Service -Force Get-Service -Name WerSvc | Set-Service -StartupType Disabled } "Enable" { Get-ScheduledTask -TaskName QueueReporting -ErrorAction Ignore | Enable-ScheduledTask Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -Force -ErrorAction Ignore Get-Service -Name WerSvc | Set-Service -StartupType Manual Get-Service -Name WerSvc | Start-Service } } } <# .SYNOPSIS The feedback frequency .PARAMETER Never Change the feedback frequency to "Never" .PARAMETER Automatically Change feedback frequency to "Automatically" .EXAMPLE FeedbackFrequency -Never .EXAMPLE FeedbackFrequency -Automatically .NOTES Current user #> function FeedbackFrequency { param ( [Parameter( Mandatory = $true, ParameterSetName = "Never" )] [switch] $Never, [Parameter( Mandatory = $true, ParameterSetName = "Automatically" )] [switch] $Automatically ) # Remove all policies in order to make changes visible in UI Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name DoNotShowFeedbackNotifications -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name DoNotShowFeedbackNotifications -Type CLEAR Remove-ItemProperty -Path HKCU:\Software\Microsoft\Siuf\Rules -Name PeriodInNanoSeconds -Force -ErrorAction Ignore switch ($PSCmdlet.ParameterSetName) { "Never" { if (-not (Test-Path -Path HKCU:\Software\Microsoft\Siuf\Rules)) { New-Item -Path HKCU:\Software\Microsoft\Siuf\Rules -Force } New-ItemProperty -Path HKCU:\Software\Microsoft\Siuf\Rules -Name NumberOfSIUFInPeriod -PropertyType DWord -Value 0 -Force } "Automatically" { Remove-ItemProperty -Path HKCU:\Software\Microsoft\Siuf\Rules -Name NumberOfSIUFInPeriod -Force -ErrorAction Ignore } } } <# .SYNOPSIS The diagnostics tracking scheduled tasks .PARAMETER Disable Turn off the diagnostics tracking scheduled tasks .PARAMETER Enable Turn on the diagnostics tracking scheduled tasks .EXAMPLE ScheduledTasks -Disable .EXAMPLE ScheduledTasks -Enable .NOTES Current user #> function ScheduledTasks { param ( [Parameter( Mandatory = $true, ParameterSetName = "Disable" )] [switch] $Disable, [Parameter( Mandatory = $true, ParameterSetName = "Enable" )] [switch] $Enable ) Add-Type -AssemblyName PresentationCore, PresentationFramework # Initialize an array list to store the selected scheduled tasks $SelectedTasks = New-Object -TypeName System.Collections.ArrayList($null) # The following tasks will have their checkboxes checked [string[]]$CheckedScheduledTasks = @( # Gathers Win32 application data for App Backup scenario "MareBackup", # Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program "Microsoft Compatibility Appraiser", # Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program "Microsoft Compatibility Appraiser Exp", # Scans startup entries and raises notification to the user if there are too many startup entries. "StartupAppTask", # This task collects and uploads autochk SQM data if opted-in to the Microsoft Customer Experience Improvement Program "Proxy", # If the user has consented to participate in the Windows Customer Experience Improvement Program, this job collects and sends usage data to Microsoft "Consolidator", # The USB CEIP (Customer Experience Improvement Program) task collects Universal Serial Bus related statistics and information about your machine and sends it to the Windows Device Connectivity engineering group at Microsoft # The information received is used to help improve the reliability, stability, and overall functionality of USB in Windows # If the user has not consented to participate in Windows CEIP, this task does not do anything "UsbCeip", # The Windows Disk Diagnostic reports general disk and system information to Microsoft for users participating in the Customer Experience Program "Microsoft-Windows-DiskDiagnosticDataCollector", # This task shows various Map related toasts "MapsToastTask", # This task checks for updates to maps which you have downloaded for offline use # Disabling this task will prevent Windows from notifying you of updated maps "MapsUpdateTask" ) #region XAML Markup # The section defines the design of the upcoming dialog box [xml]$XAML = @"