diff --git a/Download_Latest_Sophia.ps1 b/Download_Latest_Sophia.ps1 index c6b96d57..b044b9dc 100644 --- a/Download_Latest_Sophia.ps1 +++ b/Download_Latest_Sophia.ps1 @@ -25,7 +25,8 @@ if ($CurrentUserName -ne $LoginUserName) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose - break + pause + exit } if ($Host.Version.Major -eq 5) diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1 index 675d7e53..71218d39 100644 --- a/Download_Sophia.ps1 +++ b/Download_Sophia.ps1 @@ -25,7 +25,8 @@ if ($CurrentUserName -ne $LoginUserName) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose - break + pause + exit } if ($Host.Version.Major -eq 5) diff --git a/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1 index cea6e909..5ef27d3e 100644 --- a/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1 @@ -1,6 +1,6 @@ ConvertFrom-StringData -StringData @' UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows. -UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 22H2. Twój system operacyjny to {0}. +UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 22H2. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 index fce95bfe..088088c7 100644 --- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 @@ -509,16 +509,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -530,9 +524,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try + { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -567,7 +573,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [Microsoft.Management.Infrastructure.CimException] { @@ -3270,7 +3276,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -6082,7 +6088,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -9608,7 +9614,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -10568,7 +10574,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -10799,12 +10805,12 @@ function RecentlyAddedApps } New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR } } } @@ -12198,17 +12204,13 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -12638,17 +12640,13 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -12956,17 +12954,13 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -13128,7 +13122,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -15265,23 +15260,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_10/Sophia.ps1 b/src/Sophia_Script_for_Windows_10/Sophia.ps1 index 3a78e559..d5977ed5 100644 --- a/src/Sophia_Script_for_Windows_10/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10/Sophia.ps1 @@ -125,7 +125,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 index d709d4c3..56c672ed 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS The TAB completion for functions and their arguments - Version: 5.10.2 + Version: 5.10.3 Date: 06.02.2025 Copyright (c) 2014—2025 Team Sophia @@ -49,7 +49,7 @@ function Sophia Clear-Host -$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.10.2 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" +$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.10.3 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1 index de89e2fd..aee6d06d 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1 @@ -1,6 +1,6 @@ ConvertFrom-StringData -StringData @' UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows. -UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2019. Twój system operacyjny to {0}. +UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2019. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 index 47b736e6..a3383b89 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 @@ -1,6 +1,6 @@ @{ RootModule = '..\Module\Sophia.psm1' - ModuleVersion = '5.10.2' + ModuleVersion = '5.10.3' GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01' Author = 'Team Sophia' Copyright = '(c) 2014—2025 Team Sophia. All rights reserved' 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 d1a58206..8e7df4f0 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 @@ -3,7 +3,7 @@ Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks .VERSION - 5.10.2 + 5.10.3 .DATE 06.02.2025 @@ -481,16 +481,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -502,9 +496,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try + { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -539,7 +545,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [Microsoft.Management.Infrastructure.CimException] { @@ -2724,7 +2730,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -4686,7 +4692,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -7832,7 +7838,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -8740,7 +8746,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -8802,12 +8808,12 @@ function RecentlyAddedApps } New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR } } } @@ -8979,17 +8985,14 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -9419,17 +9422,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -9737,17 +9737,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -9909,7 +9906,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -11721,23 +11719,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 index 17c5e2bd..fe3b0549 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 @@ -3,7 +3,7 @@ Default preset file for "Sophia Script for Windows 10 LTSC 2019" .VERSION - 5.10.2 + 5.10.3 .DATE 06.02.2025 @@ -75,7 +75,7 @@ param Clear-Host -$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.10.2 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" +$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.10.3 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) Team Sophia, 2014$([System.Char]0x2013)2025" # Checking whether all files were expanded before running $ScriptFiles = @( @@ -123,7 +123,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 index 0d8624a6..540d01f9 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 @@ -156,6 +156,23 @@ $Parameters = @{ continue } + # If a module command is UserFolders + if ($Command -eq "UserFolders") + { + # Get all command arguments, excluding defaults + foreach ($ParameterSet in $ParameterSets.Name) + { + $ValidValues = ((Get-Command -Name UserFolders).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues + foreach ($ValidValue in $ValidValues) + { + # The "UserFolders -ThreeDObjects Hide" construction + "UserFolders" + " " + "-" + $ParameterSet + " " + $ValidValue | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""} + } + + continue + } + } + foreach ($ParameterSet in $ParameterSets.Name) { # The "Function -Argument" construction diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1 index 5ef0ae6f..a32b39b9 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1 @@ -1,6 +1,6 @@ ConvertFrom-StringData -StringData @' UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows. -UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2021. Twój system operacyjny to {0}. +UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2021. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. 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 e50a00c2..f10620f1 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 @@ -481,16 +481,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -502,9 +496,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try + { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -539,7 +545,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [Microsoft.Management.Infrastructure.CimException] { @@ -2944,7 +2950,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -5069,7 +5075,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -8471,7 +8477,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -9379,7 +9385,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -9610,12 +9616,12 @@ function RecentlyAddedApps } New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR } } } @@ -10101,17 +10107,14 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -10541,17 +10544,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -10859,17 +10859,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -11031,7 +11028,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -13086,23 +13084,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 index 011414d4..358ae3d6 100644 --- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 @@ -123,7 +123,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/de-DE/Sophia.psd1 index 111d74bd..847a183a 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/de-DE/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/de-DE/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Bitte schließen Sie PowerShell 7 und führen Sie das Skript erneut aus. UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows. UnsupportedOSBuild = Das Skript unterstützt nur Windows 10 22H2. Ihr Betriebssystem ist {0}. UnsupportedWindowsTerminal = Die Windows Terminal-Version ist niedriger als 1.20. Bitte aktualisieren Sie es im Microsoft Store und versuchen Sie es erneut. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/en-US/Sophia.psd1 index ed0e8224..99d9829f 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/en-US/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/en-US/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Please close PowerShell 7 and re-run the script again. UnsupportedOSBitness = The script supports 64-bit Windows only. UnsupportedOSBuild = The script supports only Windows 10 22H2. Your OS is {0}. UnsupportedWindowsTerminal = Windows Terminal version is lower than 1.20. Please update it in the Microsoft Store and try again. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/es-ES/Sophia.psd1 index 784b7e85..65a7d1c0 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/es-ES/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/es-ES/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Cierre PowerShell 7 y vuelva a ejecutar el script. UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits. UnsupportedOSBuild = El script sólo es compatible con Windows 10 22H2. Su sistema operativo es {0}. UnsupportedWindowsTerminal = La versión de Windows Terminal es inferior a la 1.20. Por favor, actualízala en la Microsoft Store e inténtalo de nuevo. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/fr-FR/Sophia.psd1 index 2ecddea9..50781cfb 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/fr-FR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/fr-FR/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Veuillez fermer PowerShell 7 et réexécuter le script. UnsupportedOSBitness = Le script n'est compatible qu'avec Windows 64 bits. UnsupportedOSBuild = Le script ne supporte que Windows 10 22H2. Votre système d'exploitation est {0}. UnsupportedWindowsTerminal = La version de Windows Terminal est inférieure à 1.20. Veuillez la mettre à jour dans le Microsoft Store et réessayer. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/hu-HU/Sophia.psd1 index 305a7f5f..7fa9d8a8 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/hu-HU/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/hu-HU/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Kérjük, zárja be a PowerShell 7 programot, és futtassa újra a szkriptet. UnsupportedOSBitness = A szkript csak a 64 bites Windows-t támogatja. UnsupportedOSBuild = A szkript csak a Windows 10 22H2 rendszert támogatja. Az Ön operációs rendszere {0}. UnsupportedWindowsTerminal = A Windows Terminal verziója alacsonyabb, mint 1.20. Kérjük, frissítse azt a Microsoft Store-ban, és próbálja meg újra. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/it-IT/Sophia.psd1 index 2ea1f53d..ef855f54 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/it-IT/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/it-IT/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Chiudere PowerShell 7 e rieseguire lo script. UnsupportedOSBitness = Lo script supporta solo Windows a 64 bit. UnsupportedOSBuild = Lo script supporta solo Windows 10 22H2. Il vostro sistema operativo è {0}. UnsupportedWindowsTerminal = La versione di Windows Terminal è inferiore a 1.20. Aggiornarla nel Microsoft Store e riprovare. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pl-PL/Sophia.psd1 index f1a327aa..f9795c8b 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pl-PL/Sophia.psd1 @@ -1,6 +1,7 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Zamknij PowerShell 7 i ponownie uruchom skrypt. UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows. -UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 22H2. Twój system operacyjny to {0}. +UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 22H2. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pt-BR/Sophia.psd1 index b56c902b..36ce6861 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pt-BR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/pt-BR/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Feche o PowerShell 7 e execute o script novamente. UnsupportedOSBitness = O guião suporta apenas Windows de 64 bits. UnsupportedOSBuild = O script é compatível apenas com o Windows 10 22H2. Seu sistema operacional é o {0}. UnsupportedWindowsTerminal = A versão do Windows Terminal é inferior a 1.20. Atualize-a na Microsoft Store e tente novamente. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/ru-RU/Sophia.psd1 index fc7e7452..a23312e0 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/ru-RU/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/ru-RU/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Пожалуйста, закройте PowerShell 7 и запустите скрип заново. UnsupportedOSBitness = Скрипт поддерживает только 64-битную версию Windows. UnsupportedOSBuild = Скрипт поддерживает только Windows 10 22H2. Ваша ОС — {0}. UnsupportedWindowsTerminal = Версия Windows Terminal ниже 1.20. Пожалуйста, обновите его в Microsoft Store и попробуйте заново. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/tr-TR/Sophia.psd1 index cd782835..5734e0e2 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/tr-TR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/tr-TR/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Lütfen PowerShell 7 yi kapatın ve komut dosyasını yeniden çalıştırın. UnsupportedOSBitness = Komut dosyası yalnızca 64 bit Windows'u destekler. UnsupportedOSBuild = Komut dosyası yalnızca Windows 10 22H2'yi destekler. Sizin işletim sisteminiz {0}. UnsupportedWindowsTerminal = Windows Terminal sürümü 1.20'den daha düşük. Lütfen Microsoft Store'da güncelleyin ve tekrar deneyin. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/uk-UA/Sophia.psd1 index a2cb1462..b314ebea 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/uk-UA/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/uk-UA/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Будь ласка, закрийте PowerShell 7 і запустіть сценарій знову. UnsupportedOSBitness = Скрипт підтримує тільки 64-розрядну версію Windows. UnsupportedOSBuild = Скрипт підтримує тільки Windows 10 22H2. Ваша ОС — {0}. UnsupportedWindowsTerminal = Версія Windows Terminal нижча за 1.20. Будь ласка, оновіть його в Microsoft Store і спробуйте заново. diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/zh-CN/Sophia.psd1 index b1d3c3f9..d822f10a 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/zh-CN/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Localizations/zh-CN/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = 请关闭PowerShell 7并重新运行脚本。 UnsupportedOSBitness = 该脚本仅支持64位Windows。 UnsupportedOSBuild = 腳本僅支援 Windows 10 22H2。您的作業系統是 {0}。 UnsupportedWindowsTerminal = Windows Terminal版本低於1.20。請在Microsoft商店更新後再試。 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 cc110217..bdb44fa2 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 @@ -67,7 +67,21 @@ function InitialActions [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Import PowerShell 5.1 modules - Import-Module -Name Microsoft.PowerShell.Management, PackageManagement, Appx, DISM -UseWindowsPowerShell + try + { + Import-Module -Name Microsoft.PowerShell.Management, PackageManagement, Appx, DISM -UseWindowsPowerShell -Force -ErrorAction Stop + } + catch + { + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.PowerShellImportFailed + Write-Information -MessageData "" -InformationAction Continue + + Write-Verbose -Message "https://t.me/sophia_chat" -Verbose + Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose + + exit + } # https://github.com/PowerShell/PowerShell/issues/21070 $Script:CompilerOptions = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll") @@ -522,16 +536,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -543,9 +551,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] + { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -580,7 +600,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [System.Management.Automation.RemoteException] { @@ -3288,7 +3308,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -6102,7 +6122,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -9628,7 +9648,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -10588,7 +10608,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -10819,12 +10839,12 @@ function RecentlyAddedApps } New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecentlyAddedApps -Type CLEAR } } } @@ -12228,17 +12248,14 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -12668,17 +12685,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -12986,17 +13000,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking if we're trying to create the task when it was already created as another user @@ -13158,7 +13169,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -15295,23 +15307,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 index 0721d46f..5a44af3f 100644 --- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 @@ -129,7 +129,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1 index d96aef01..0c01f0d6 100644 --- a/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1 @@ -1,7 +1,7 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = Le script est compatible avec Windows 11 23H2 et les versions ultérieures. Votre système d'exploitation est {0}. +UnsupportedOSBuild = Le script ne supporte que Windows 11 23H2. Votre système d'exploitation est {0}. UnsupportedWindowsTerminal = La version de Windows Terminal est inférieure à 1.20. Veuillez la mettre à jour dans le Microsoft Store et réessayer. -UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. +UpdateWarning = Votre version de Windows 11: {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité. LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur. UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell. diff --git a/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1 index b4791130..2b3511e7 100644 --- a/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1 @@ -1,5 +1,5 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2 és magasabb verziószámú operációs rendszereket. Az Ön {0}. +UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2 és magasabb verziószámú operációs rendszereket. Az Ön operációs rendszere {0}. UnsupportedWindowsTerminal = A Windows Terminal verziója alacsonyabb, mint 1.20. Kérjük, frissítse azt a Microsoft Store-ban, és próbálja meg újra. UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: {2} és újabb verziók. Futtassa a Windows Update programot, és próbálja meg újra. UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut. diff --git a/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1 index b6826cb2..4b6030d1 100644 --- a/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1 @@ -1,5 +1,5 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = Komut dosyası Windows 11 23H2 ve üstünü destekler. İşletim sisteminiz {0}. +UnsupportedOSBuild = Komut dosyası Windows 11 23H2 ve üstünü destekler. Sizin işletim sisteminiz {0}. UnsupportedWindowsTerminal = Windows Terminal sürümü 1.20'den daha düşük. Lütfen Microsoft Store'da güncelleyin ve tekrar deneyin. UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: {2} ve üzeri sürümler.. Windows Update'i çalıştırın ve tekrar deneyin. UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu. diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 index 1daf77e7..3a936021 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 @@ -496,16 +496,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -517,9 +511,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try + { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -554,7 +560,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [Microsoft.Management.Infrastructure.CimException] { @@ -3056,7 +3062,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -4673,14 +4679,14 @@ function StartRecommendedSection New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start -Name HideRecommendedSection -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR } } } @@ -5580,7 +5586,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -9097,7 +9103,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -10082,7 +10088,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -11187,19 +11193,19 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center + # Enable notifications + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Remove registry keys if Windows Script Host is disabled Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications - Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Checking whether VBS engine is enabled if ((Get-WindowsCapability -Online -Name VBSCRIPT*).State -ne "Installed") { @@ -11293,13 +11299,6 @@ function CleanupTask New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\$VolumeCache" -Name StateFlags1337 -PropertyType DWord -Value 2 -Force } - # Persist Sophia notifications to prevent to immediately disappear from Action Center - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force @@ -11648,17 +11647,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -11987,17 +11983,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -12180,7 +12173,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -14249,23 +14243,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_11/Sophia.ps1 b/src/Sophia_Script_for_Windows_11/Sophia.ps1 index 518bb852..9af5b972 100644 --- a/src/Sophia_Script_for_Windows_11/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11/Sophia.ps1 @@ -121,7 +121,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/fr-FR/Sophia.psd1 index b436e907..9174b54a 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/fr-FR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/fr-FR/Sophia.psd1 @@ -1,7 +1,7 @@ ConvertFrom-StringData -StringData @' UnsupportedOSBuild = Le script ne supporte que Windows 11 Enterprise LTSC 2024. Votre système d'exploitation est {0}. UnsupportedWindowsTerminal = La version de Windows Terminal est inférieure à 1.20. Veuillez la mettre à jour dans le Microsoft Store et réessayer. -UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. +UpdateWarning = Votre version de Windows 11: {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité. LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur. UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell. diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/pl-PL/Sophia.psd1 index 548a6afa..fc4b9737 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Localizations/pl-PL/Sophia.psd1 @@ -1,5 +1,5 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2021. Twój system operacyjny to {0}. +UnsupportedOSBuild = Skrypt obsługuje tylko system Windows 10 Enterprise LTSC 2021. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 index 4abd8e41..7cc78061 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1 @@ -482,16 +482,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -503,9 +497,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try + { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -540,7 +546,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [Microsoft.Management.Infrastructure.CimException] { @@ -3027,7 +3033,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -4493,14 +4499,14 @@ function StartRecommendedSection New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start -Name HideRecommendedSection -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR } } } @@ -5108,7 +5114,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -8625,7 +8631,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -9533,7 +9539,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -10457,17 +10463,14 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -10918,17 +10921,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -11257,17 +11257,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -11450,7 +11447,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -13078,23 +13076,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 index 164dd014..0df6da3a 100644 --- a/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_LTSC_2024/Sophia.ps1 @@ -122,7 +122,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1 index 70f4a9f5..e5df26a3 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Bitte schließen Sie PowerShell 7 und führen Sie das Skript erneut aus. UnsupportedOSBuild = Das Skript unterstützt Windows 11 23H2 und höher. Ihr Betriebssystem ist {0}. UnsupportedWindowsTerminal = Die Windows Terminal-Version ist niedriger als 1.20. Bitte aktualisieren Sie es im Microsoft Store und versuchen Sie es erneut. UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: {2} und höher. Führen Sie Windows Update aus und versuchen Sie es erneut. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1 index 696a0555..ab839160 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Please close PowerShell 7 and re-run the script again. UnsupportedOSBuild = The script supports Windows 11 23H2 and higher. Your OS is {0}. UnsupportedWindowsTerminal = Windows Terminal version is lower than 1.20. Please update it in the Microsoft Store and try again. UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: {2} and higher. Run Windows Update and try again. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1 index e7bc2d5a..58d809ec 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Cierre PowerShell 7 y vuelva a ejecutar el script. UnsupportedOSBuild = El script es compatible con Windows 11 23H2 y superiores. Su sistema operativo es {0}. UnsupportedWindowsTerminal = La versión de Windows Terminal es inferior a la 1.20. Por favor, actualízala en la Microsoft Store e inténtalo de nuevo. UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: {2} y superior. Ejecute Windows Update y vuelva a intentarlo. @@ -14,7 +15,7 @@ UnsupportedRelease = Se ha encontrado una nueva versión KeyboardArrows = Utilice las flechas {0} y {1} de su teclado para seleccionar la respuesta CustomizationWarning = ¿Ha personalizado todas las funciones del archivo predeterminado {0} antes de ejecutar Sophia Script? WindowsComponentBroken = {0} dañado o eliminado del sistema operativo. Reinstale Windows utilizando sólo una imagen ISO original. -MicroSoftStorePowerShellWarning = PowerShell descargado de Microsoft Store no es compatible. Ejecute una versión MSI.\nhttps://github.com/powershell/powershell/releases/latest +MicroSoftStorePowerShellWarning = PowerShell téléchargé depuis le Microsoft Store n'est pas pris en charge. Veuillez exécuter une version MSI.\nhttps://github.com/powershell/powershell/releases/latest ControlledFolderAccessDisabled = Acceso a la carpeta controlada deshabilitado. InitialActionsCheckFailed = La función InitialActions no se puede cargar desde el archivo de presets {0}. Compruebe el archivo de preajuste y vuelva a intentarlo. ScheduledTasks = Tareas programadas diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1 index 0f9861c7..02e9bfd4 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1 @@ -1,7 +1,8 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = Le script est compatible avec Windows 11 23H2 et les versions ultérieures. Votre système d'exploitation est {0}. +PowerShellImportFailed = Veuillez fermer PowerShell 7 et réexécuter le script. +UnsupportedOSBuild = Le script ne supporte que Windows 11 23H2. Votre système d'exploitation est {0}. UnsupportedWindowsTerminal = La version de Windows Terminal est inférieure à 1.20. Veuillez la mettre à jour dans le Microsoft Store et réessayer. -UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. +UpdateWarning = Votre version de Windows 11: {0}.{1}. Versions prises en charge: {2} et plus. Exécutez Windows Update et réessayez. UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité. LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur. UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell. @@ -14,7 +15,7 @@ UnsupportedRelease = Une nouvelle version du script a ét KeyboardArrows = Veuillez utiliser les touches fléchées {0} et {1} de votre clavier pour sélectionner votre réponse CustomizationWarning = Avez-vous personnalisé chaque fonction du fichier de préréglage {0} avant d'exécuter Sophia Script? WindowsComponentBroken = {0} cassé ou supprimé du système d'exploitation. Réinstallez Windows en utilisant uniquement une image ISO authentique. -MicroSoftStorePowerShellWarning = PowerShell téléchargé depuis le Microsoft Store n'est pas pris en charge. Veuillez exécuter une version MSI. +MicroSoftStorePowerShellWarning = PowerShell téléchargé depuis le Microsoft Store n'est pas pris en charge. Veuillez exécuter une version MSI.\nhttps://github.com/powershell/powershell/releases/latest ControlledFolderAccessDisabled = Contrôle d'accès aux dossiers désactivé. InitialActionsCheckFailed = La fonction InitialActions ne peut pas être chargée à partir du fichier de présélection {0}. Veuillez vérifier le fichier de présélection et réessayer. ScheduledTasks = Tâches planifiées diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1 index 9de72166..ac74f970 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1 @@ -1,5 +1,6 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2 és magasabb verziószámú operációs rendszereket. Az Ön {0}. +PowerShellImportFailed = Kérjük, zárja be a PowerShell 7 programot, és futtassa újra a szkriptet. +UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2 és magasabb verziószámú operációs rendszereket. Az Ön operációs rendszere {0}. UnsupportedWindowsTerminal = A Windows Terminal verziója alacsonyabb, mint 1.20. Kérjük, frissítse azt a Microsoft Store-ban, és próbálja meg újra. UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: {2} és újabb verziók. Futtassa a Windows Update programot, és próbálja meg újra. UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1 index 62cea72c..e0c17a46 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Chiudere PowerShell 7 e rieseguire lo script. UnsupportedOSBuild = Lo script supporta Windows 11 23H2 e versioni successive. Il vostro sistema operativo è {0}. UnsupportedWindowsTerminal = La versione di Windows Terminal è inferiore a 1.20. Aggiornarla nel Microsoft Store e riprovare. UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: {2} e successive. Eseguire Windows Update e riprovare. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1 index 84c0da54..619d614e 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Zamknij PowerShell 7 i ponownie uruchom skrypt. UnsupportedOSBuild = Skrypt obsługuje system Windows 11 23H2 i nowsze wersje. Twoim systemem operacyjnym jest {0}. UnsupportedWindowsTerminal = Wersja Windows Terminal jest niższa niż 1.20. Zaktualizuj ją w Microsoft Store i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: {2} i nowsze. Uruchom aktualizację systemu Windows i spróbuj ponownie. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1 index 9be3f35d..296923db 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Feche o PowerShell 7 e execute o script novamente. UnsupportedOSBuild = O script é compatível com o Windows 11 23H2 e superior. Seu sistema operacional é o {0}. UnsupportedWindowsTerminal = A versão do Windows Terminal é inferior a 1.20. Atualize-a na Microsoft Store e tente novamente. UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1 index 83679ffa..6107fbd6 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Пожалуйста, закройте PowerShell 7 и запустите скрип заново. UnsupportedOSBuild = Скрипт поддерживает Windows 11 23H2 и выше. Ваша ОС — {0}. UnsupportedWindowsTerminal = Версия Windows Terminal ниже 1.20. Пожалуйста, обновите его в Microsoft Store и попробуйте заново. UpdateWarning = Ваш билд Windows 11: {0}.{1}. Поддерживаемые сборки: {2} и выше. Запустите обновление Windows и попробуйте заново. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1 index 6d5fccfe..589dcfe5 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1 @@ -1,5 +1,6 @@ ConvertFrom-StringData -StringData @' -UnsupportedOSBuild = Komut dosyası Windows 11 23H2 ve üstünü destekler. İşletim sisteminiz {0}. +PowerShellImportFailed = Lütfen PowerShell 7 yi kapatın ve komut dosyasını yeniden çalıştırın. +UnsupportedOSBuild = Komut dosyası Windows 11 23H2 ve üstünü destekler. Sizin işletim sisteminiz {0}. UnsupportedWindowsTerminal = Windows Terminal sürümü 1.20'den daha düşük. Lütfen Microsoft Store'da güncelleyin ve tekrar deneyin. UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: {2} ve üzeri sürümler.. Windows Update'i çalıştırın ve tekrar deneyin. UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1 index 3d2e368e..1972850c 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = Будь ласка, закрийте PowerShell 7 і запустіть сценарій знову. UnsupportedOSBuild = Скрипт підтримує тільки Windows 11 23H2 і вище. Ваша ОС — {0}. UnsupportedWindowsTerminal = Версія Windows Terminal нижча за 1.20. Будь ласка, оновіть його в Microsoft Store і спробуйте заново. UpdateWarning = Ваш білд Windows 11: {0}.{1}. Підтримувані збірки: {2} і вище.. Запустіть Windows Update і повторіть спробу. diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1 index 47d09846..efc0d2a2 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1 @@ -1,4 +1,5 @@ ConvertFrom-StringData -StringData @' +PowerShellImportFailed = 请关闭PowerShell 7并重新运行脚本。 UnsupportedOSBuild = 腳本支援 Windows 11 23H2 及更高版本。您的作業系統是 {0}。 UnsupportedWindowsTerminal = Windows Terminal版本低於1.20。請在Microsoft商店更新後再試。 UpdateWarning = 您的Windows 11构建: {0}.{1}。支援的版本:{2} 及更高版本。运行Windows Update并再次尝试。 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 d956f889..67b553e7 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 @@ -67,7 +67,21 @@ function InitialActions [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Import PowerShell 5.1 modules - Import-Module -Name Microsoft.PowerShell.Management, PackageManagement, Appx, DISM -UseWindowsPowerShell + try + { + Import-Module -Name Microsoft.PowerShell.Management, PackageManagement, Appx, DISM -UseWindowsPowerShell -Force -ErrorAction Stop + } + catch + { + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.PowerShellImportFailed + Write-Information -MessageData "" -InformationAction Continue + + Write-Verbose -Message "https://t.me/sophia_chat" -Verbose + Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose + + exit + } # https://github.com/PowerShell/PowerShell/issues/21070 $Script:CompilerOptions = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll") @@ -509,16 +523,10 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); exit } - # Checking whether WMI is corrupted - try - { - Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null - } - catch [Microsoft.Management.Infrastructure.CimException] + # Check Microsoft Defender state + if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) { - # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue - Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -530,9 +538,21 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); } # Check Microsoft Defender state - if ($null -eq (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 -ErrorAction Ignore)) + try { + $productState = (Get-CimInstance -ClassName AntiVirusProduct -Namespace root/SecurityCenter2 | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState + $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) + # Defender is a currently used AV. Continue... + if ($DefenderState -notmatch "00|01") + { + Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null + } + } + catch [Microsoft.Management.Infrastructure.CimException] + { + # Provider Load Failure exception Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1) Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") Write-Information -MessageData "" -InformationAction Continue @@ -567,7 +587,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); try { $Script:DefenderMpPreferenceBroken = $false - (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess + (Get-MpPreference -ErrorAction Stop).EnableControlledFolderAccess } catch [System.Management.Automation.RemoteException] { @@ -3074,7 +3094,7 @@ function QuickAccessRecentFiles # Remove all policies in order to make changes visible in UI only if it's possible Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer, HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name NoRecentDocsHistory -Force -ErrorAction Ignore Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name NoRecentDocsHistory -Type CLEAR switch ($PSCmdlet.ParameterSetName) { @@ -4691,14 +4711,14 @@ function StartRecommendedSection New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -PropertyType DWord -Value 1 -Force - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type DWORD -Value 1 } "Show" { Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Education -Name IsEducationEnvironment -Force -ErrorAction Ignore Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start -Name HideRecommendedSection -Force -ErrorAction Ignore - Set-Policy -Scope User -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR + Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name HideRecommendedSection -Type CLEAR } } } @@ -5600,7 +5620,7 @@ function WindowsFeatures [void]$Window.Close() $SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose} - $SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart + $SelectedFeatures | Enable-WindowsOptionalFeature -Online -All -NoRestart } function Add-FeatureControl @@ -9117,7 +9137,7 @@ public static long MakeLong(uint left, uint right) New-ItemProperty -Path "HKCU:\Software\Classes\$ProgId\DefaultIcon" -Name "(default)" -PropertyType String -Value $Icon -Force } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -Type DWord -Value 0 -Force + New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name "$($ProgID)_$($Extension)" -PropertyType DWord -Value 0 -Force if ($Extension.Contains(".")) { @@ -10102,7 +10122,7 @@ function RegistryBackup { "Enable" { - New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -Type DWord -Value 1 -Force + New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager" -Name EnablePeriodicBackup -PropertyType DWord -Value 1 -Force } "Disable" { @@ -11217,17 +11237,14 @@ function CleanupTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -11678,17 +11695,14 @@ function SoftwareDistributionTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -12017,17 +12031,14 @@ function TempTask { "Register" { - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - - # Remove registry keys if Windows Script Host is disabled - Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Script Host\Settings", "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Force -ErrorAction Ignore - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR # Checking whether VBS engine is enabled @@ -12210,7 +12221,8 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_ (-join ("`$env:SystemDrive\", '`$Windows.~WS')), "`$env:SystemDrive\ESD", "`$env:SystemDrive\Intel", - "`$env:SystemDrive\PerfLogs" + "`$env:SystemDrive\PerfLogs", + "`$env:SystemRoot\ServiceProfiles\NetworkService\AppData\Local\Temp" ) if ((Get-ChildItem -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Name -eq "ReAgentOld.xml"}).FullName) @@ -14279,23 +14291,16 @@ public static void PostMessage() #endregion Other actions #region Toast notifications - # Persist Sophia notifications to prevent to immediately disappear from Action Center - # Enable notifications in Action Center - Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore - Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - # Enable notifications Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\PushNotifications -Name ToastEnabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.ActionCenter.SmartOptOut -Name Enable -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowBanner, ShowInActionCenter, Enabled -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\SystemSettings\AccountNotifications -Name EnableAccountNotifications -Force -ErrorAction Ignore + Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer, HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\CurrentVersion\PushNotifications -Name NoToastApplicationNotification -Force -ErrorAction Ignore + Set-Policy -Scope Computer -Path SOFTWARE\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR Set-Policy -Scope User -Path Software\Policies\Microsoft\Windows\Explorer -Name DisableNotificationCenter -Type CLEAR - if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia)) - { - New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Force - } - New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Sophia -Name ShowInActionCenter -PropertyType DWord -Value 1 -Force - if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia)) { New-Item -Path Registry::HKEY_CLASSES_ROOT\AppUserModelId\Sophia -Force diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 index 9161ac04..317b97b6 100644 --- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 +++ b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 @@ -128,7 +128,7 @@ try } catch [System.InvalidOperationException] { - Write-Warning -Message $Localization.UnsupportedPowerShell + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) Write-Verbose -Message "https://t.me/sophia_chat" -Verbose Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose