diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index 7dbb9fab..1d2eb106 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -1040,7 +1040,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -6747,15 +6746,9 @@ function WindowsCapabilities # Internet Explorer 11 "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -13383,9 +13376,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -13692,9 +13686,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -14008,9 +14003,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @" diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 index 844449a8..69ed3099 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 @@ -928,7 +928,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -5376,15 +5375,9 @@ function WindowsCapabilities # Internet Explorer 11 "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -9906,9 +9899,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -10215,9 +10209,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -10531,9 +10526,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @" diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 index 849c37d9..b9c87a74 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 @@ -928,7 +928,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -5758,15 +5757,9 @@ function WindowsCapabilities # Internet Explorer 11 "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -11040,9 +11033,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -11349,9 +11343,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -11665,9 +11660,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @" diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 index a1864c05..0224708e 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 @@ -1029,7 +1029,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -6736,15 +6735,9 @@ function WindowsCapabilities # Internet Explorer 11 "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -13392,9 +13385,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -13701,9 +13695,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -14017,9 +14012,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @" diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index 7d98e296..521d85f7 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -1016,7 +1016,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -3294,25 +3293,32 @@ function SearchHighlights $Show ) - # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $BingSearchEnabled = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BingSearchEnabled", $null)) - $DisableSearchBoxSuggestions = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", $null)) - if (($BingSearchEnabled -eq 1) -or ($DisableSearchBoxSuggestions -eq 1)) - { - Write-Information -MessageData "" -InformationAction Continue - Write-Verbose -Message $Localization.Skipped -Verbose - - return - } - switch ($PSCmdlet.ParameterSetName) { "Hide" { - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 0 -Force + # Check whether "Ask Copilot" and "Find results in Web" (Web) were disabled. They also disable Search Highlights automatically + # Due to "Set-StrictMode -Version Latest" we have to use GetValue() + $BingSearchEnabled = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BingSearchEnabled", $null)) + $DisableSearchBoxSuggestions = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", $null)) + if (($BingSearchEnabled -eq 1) -or ($DisableSearchBoxSuggestions -eq 1)) + { + Write-Information -MessageData "" -InformationAction Continue + Write-Verbose -Message $Localization.Skipped -Verbose + + return + } + else + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 0 -Force + } } "Show" { + # Enable "Ask Copilot" and "Find results in Web" (Web) icons in Windows Search in order to enable Search Highlights + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableSearchBoxSuggestions -Force -ErrorAction Ignore + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 1 -Force } } @@ -6132,15 +6138,9 @@ function WindowsCapabilities # Internet Explorer mode "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -12505,9 +12505,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -12814,9 +12815,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -13130,9 +13132,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding UTF8 -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding UTF8 -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @" diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 index c191390e..639bd795 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 @@ -1002,7 +1002,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Get the name of a preset (e.g Sophia.ps1) regardless it was named # $_.File has no EndsWith() method $PresetName = Split-Path -Path (((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}) -Leaf - Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message ($Localization.CustomizationWarning -f $PresetName) -Verbose do @@ -3280,25 +3279,32 @@ function SearchHighlights $Show ) - # Due to "Set-StrictMode -Version Latest" we have to use GetValue() - $BingSearchEnabled = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BingSearchEnabled", $null)) - $DisableSearchBoxSuggestions = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", $null)) - if (($BingSearchEnabled -eq 1) -or ($DisableSearchBoxSuggestions -eq 1)) - { - Write-Information -MessageData "" -InformationAction Continue - Write-Verbose -Message $Localization.Skipped -Verbose - - return - } - switch ($PSCmdlet.ParameterSetName) { "Hide" { - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 0 -Force + # Check whether "Ask Copilot" and "Find results in Web" (Web) were disabled. They also disable Search Highlights automatically + # Due to "Set-StrictMode -Version Latest" we have to use GetValue() + $BingSearchEnabled = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Search", "BingSearchEnabled", $null)) + $DisableSearchBoxSuggestions = ([Microsoft.Win32.Registry]::GetValue("HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer", "DisableSearchBoxSuggestions", $null)) + if (($BingSearchEnabled -eq 1) -or ($DisableSearchBoxSuggestions -eq 1)) + { + Write-Information -MessageData "" -InformationAction Continue + Write-Verbose -Message $Localization.Skipped -Verbose + + return + } + else + { + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 0 -Force + } } "Show" { + # Enable "Ask Copilot" and "Find results in Web" (Web) icons in Windows Search in order to enable Search Highlights + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name DisableSearchBoxSuggestions -Force -ErrorAction Ignore + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SearchSettings -Name IsDynamicSearchBoxEnabled -PropertyType DWord -Value 1 -Force } } @@ -6118,15 +6124,9 @@ function WindowsCapabilities # Internet Explorer mode "Browser.InternetExplorer*", - # Math Recognizer - "MathRecognizer*", - # Windows Media Player # If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall this feature - "Media.WindowsMediaPlayer*", - - # OpenSSH Client - "OpenSSH.Client*" + "Media.WindowsMediaPlayer*" ) # The following optional features will be excluded from the display @@ -12511,9 +12511,10 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF") { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Value $ToastNotification -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $ToastNotification = @" @@ -12820,9 +12821,10 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Value $SoftwareDistributionTask -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $SoftwareDistributionTask = @" @@ -13136,9 +13138,10 @@ Remove-Item -Path `$Paths -Recurse -Force { New-Item -Path $env:SystemRoot\System32\Tasks\Sophia -ItemType Directory -Force } - Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding Default -Force + # Save in UTF8 with BOM + Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Value $TempTask -Encoding utf8BOM -Force # Replace here-string double quotes with single ones - (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding Default -Force + (Get-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding utf8BOM).Replace('@""', '@"').Replace('""@', '"@') | Set-Content -Path "$env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1" -Encoding utf8BOM -Force # Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up $TempTask = @"