diff --git a/Sophia/LTSC/Functions.ps1 b/Sophia/LTSC/Functions.ps1 index 388fe4cf..d5f308eb 100644 --- a/Sophia/LTSC/Functions.ps1 +++ b/Sophia/LTSC/Functions.ps1 @@ -2,8 +2,8 @@ .SYNOPSIS The TAB completion for functions and their arguments - Version: v5.2.12 - Date: 06.08.2021 + Version: v5.2.13 + Date: 25.08.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & Inestic @@ -54,7 +54,7 @@ function Sophia Clear-Host -$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC v5.2.12 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014–2021" +$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC v5.2.13 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014–2021" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force @@ -101,9 +101,9 @@ $Parameters = @{ } Register-ArgumentCompleter @Parameters -Write-Information -MessageData "`n" -InformationAction Continue +Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message "Sophia -Functions " -Verbose Write-Verbose -Message "Sophia -Functions temp" -Verbose Write-Verbose -Message "Sophia -Functions `"DiagTrackService -Disable`", `"DiagnosticDataLevel -Minimal`", UninstallUWPApps" -Verbose -Write-Information -MessageData "`n" -InformationAction Continue +Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message "`"Set-Association -ProgramPath ```"%ProgramFiles%\Notepad++\notepad++.exe```" -Extension .txt -Icon ```"%ProgramFiles%\Notepad++\notepad++.exe,0```"`"" -Verbose diff --git a/Sophia/LTSC/Localizations/de-DE/Sophia.psd1 b/Sophia/LTSC/Localizations/de-DE/Sophia.psd1 index 7679093b..34717bb3 100644 --- a/Sophia/LTSC/Localizations/de-DE/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/de-DE/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = Das Skript unterstützt nur Windows UnsupportedOSBuild = Das Skript unterstützt Windows 10 1809 Enterprise LTSC UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte -UnsupportedPowerShell = Sie versuchen, ein Skript über PowerShell {0} auszuführen. Führen Sie das Skript in der entsprechenden PowerShell-Version aus +UnsupportedPowerShell = Sie versuchen, ein Skript über PowerShell {0}.{1} auszuführen. Führen Sie das Skript in der entsprechenden PowerShell-Version aus UnsupportedISE = Das Skript unterstützt nicht die Ausführung über Windows PowerShell ISE Win10TweakerWarning = Wahrscheinlich wurde Ihr Betriebssystem über die Win 10 Tweaker-Hintertür infiziert UnsupportedRelease = Neue Version gefunden diff --git a/Sophia/LTSC/Localizations/en-US/Sophia.psd1 b/Sophia/LTSC/Localizations/en-US/Sophia.psd1 index fc34a9e5..6ed1209d 100644 --- a/Sophia/LTSC/Localizations/en-US/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/en-US/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = The script supports Windows 10 x64 o UnsupportedOSBuild = The script supports Windows 10 1809 Enterprise LTSC UnsupportedLanguageMode = The PowerShell session in running in a limited language mode LoggedInUserNotAdmin = The logged-on user doesn't have admin rights -UnsupportedPowerShell = You're trying to run script via PowerShell {0}. Run the script in the appropriate PowerShell version +UnsupportedPowerShell = You're trying to run script via PowerShell {0}.{1}.{1}. Run the script in the appropriate PowerShell version UnsupportedISE = The script doesn't support running via Windows PowerShell ISE Win10TweakerWarning = Probably your OS was infected via the Win 10 Tweaker backdoor UnsupportedRelease = A new version found diff --git a/Sophia/LTSC/Localizations/es-ES/Sophia.psd1 b/Sophia/LTSC/Localizations/es-ES/Sophia.psd1 index 0b91244f..c2b6ca94 100644 --- a/Sophia/LTSC/Localizations/es-ES/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/es-ES/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = El script sólo es compatible con Wi UnsupportedOSBuild = El script es compatible con versión Windows 10 1809 Enterprise LTSC UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador -UnsupportedPowerShell = Estás intentando ejecutar el script a través de PowerShell {0}. Ejecute el script en la versión apropiada de PowerShell +UnsupportedPowerShell = Estás intentando ejecutar el script a través de PowerShell {0}.{1}. Ejecute el script en la versión apropiada de PowerShell UnsupportedISE = El script no es compatible con la ejecución a través de Windows PowerShell ISE Win10TweakerWarning = Probablemente su sistema operativo fue infectado a través del backdoor Win 10 Tweaker UnsupportedRelease = Una nueva versión encontrada diff --git a/Sophia/LTSC/Localizations/fr-FR/Sophia.psd1 b/Sophia/LTSC/Localizations/fr-FR/Sophia.psd1 index b4e1092a..b6080276 100644 --- a/Sophia/LTSC/Localizations/fr-FR/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/fr-FR/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = Le script supporte uniquement Window UnsupportedOSBuild = Le script supporte le version Windows 10 1809 Enterprise LTSC 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}. Exécutez le script dans la version appropriée de PowerShell +UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell UnsupportedISE = Le script ne supporte pas l'exécution via Windows PowerShell ISE Win10TweakerWarning = Votre système d'exploitation a probablement été infecté par la porte dérobée Win 10 Tweaker UnsupportedRelease = Nouvelle version trouvée diff --git a/Sophia/LTSC/Localizations/it-IT/Sophia.psd1 b/Sophia/LTSC/Localizations/it-IT/Sophia.psd1 index eaab51bf..3d5c0964 100644 --- a/Sophia/LTSC/Localizations/it-IT/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/it-IT/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = Lo script supporta solo Windows 10 x UnsupportedOSBuild = Lo script supporta Windows 10 versione 1809 Enterprise LTSC UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in una modalità di lingua limitata LoggedInUserNotAdmin = L'utente connesso non ha i diritti di amministratore -UnsupportedPowerShell = Stai cercando di eseguire lo script tramite PowerShell {0}. Esegui lo script nella versione di PowerShell appropriata +UnsupportedPowerShell = Stai cercando di eseguire lo script tramite PowerShell {0}.{1}. Esegui lo script nella versione di PowerShell appropriata UnsupportedISE = Lo script non supporta l'esecuzione tramite Windows PowerShell ISE Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker UnsupportedRelease = Nuova versione trovata diff --git a/Sophia/LTSC/Localizations/pt-BR/Sophia.psd1 b/Sophia/LTSC/Localizations/pt-BR/Sophia.psd1 index 4386ae81..3fb96829 100644 --- a/Sophia/LTSC/Localizations/pt-BR/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/pt-BR/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = O script suporta somente Windows 10 UnsupportedOSBuild = O script suporta versões Windows 10 1809 Enterprise LTSC UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador -UnsupportedPowerShell = Você está tentando executar o script via PowerShell {0}. Execute o script na versão apropriada do PowerShell +UnsupportedPowerShell = Você está tentando executar o script via PowerShell {0}.{1}. Execute o script na versão apropriada do PowerShell UnsupportedISE = O guião não suporta a execução através do Windows PowerShell ISE Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker UnsupportedRelease = Nova versão encontrada diff --git a/Sophia/LTSC/Localizations/ru-RU/Sophia.psd1 b/Sophia/LTSC/Localizations/ru-RU/Sophia.psd1 index be227176..03bc0153 100644 --- a/Sophia/LTSC/Localizations/ru-RU/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/ru-RU/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = Скрипт поддерживае UnsupportedOSBuild = Скрипт поддерживает только Windows 10 1809 Enterprise LTSC UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора -UnsupportedPowerShell = Вы пытаетесь запустить скрипт в PowerShell {0}. Запустите скрипт в соответствующей версии PowerShell +UnsupportedPowerShell = Вы пытаетесь запустить скрипт в PowerShell {0}.{1}. Запустите скрипт в соответствующей версии PowerShell UnsupportedISE = Скрипт не поддерживает работу через Windows PowerShell ISE Win10TweakerWarning = Ваша ОС, возможно, через бэкдор в Win 10 Tweaker заражена трояном UnsupportedRelease = Обнаружена новая версия diff --git a/Sophia/LTSC/Localizations/uk-UA/Sophia.psd1 b/Sophia/LTSC/Localizations/uk-UA/Sophia.psd1 index 3b35713e..307517ce 100644 --- a/Sophia/LTSC/Localizations/uk-UA/Sophia.psd1 +++ b/Sophia/LTSC/Localizations/uk-UA/Sophia.psd1 @@ -3,7 +3,7 @@ UnsupportedOSBitness = Скрипт підтримує ті UnsupportedOSBuild = Скрипт підтримує тільки Windows 10 1809 версії Enterprise LTSC UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі LoggedInUserNotAdmin = Поточний увійшов користувач не володіє правами адміністратора -UnsupportedPowerShell = Ви намагаєтеся запустити скрипт в PowerShell {0}. Запустіть скрипт у відповідній версії PowerShell +UnsupportedPowerShell = Ви намагаєтеся запустити скрипт в PowerShell {0}.{1}. Запустіть скрипт у відповідній версії PowerShell UnsupportedISE = Скрипт не підтримує роботу через Windows PowerShell ISE Win10TweakerWarning = Ваша ОС, можливо, через бекдор в Win 10 Tweaker заражена трояном UnsupportedRelease = Виявлено нову версію diff --git a/Sophia/LTSC/Module/Sophia.psm1 b/Sophia/LTSC/Module/Sophia.psm1 index 705f3c23..3de38f45 100644 --- a/Sophia/LTSC/Module/Sophia.psm1 +++ b/Sophia/LTSC/Module/Sophia.psm1 @@ -2,8 +2,8 @@ .SYNOPSIS Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks - Version: v5.2.12 - Date: 06.08.2021 + Version: v5.2.13 + Date: 25.08.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & Inestic @@ -35,7 +35,7 @@ https://github.com/farag2 https://github.com/Inestic - .NOTES + .LINK https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 https://habr.com/company/skillfactory/blog/553800/ https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ @@ -107,7 +107,7 @@ function Checkings # Check whether the script was run via PowerShell 5.1 if ($PSVersionTable.PSVersion.Major -ne 5) { - Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major) + Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor) exit } @@ -132,19 +132,11 @@ function Checkings # Check if the current module version is the latest one try { - $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" - $Parameters = @{ - Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/Sophia/LTSC/Manifest/Sophia.psd1" - OutFile = "$DownloadsFolder\Manifest.psd1" - Verbose = [switch]::Present - } - Invoke-WebRequest @Parameters + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - $LatestRelease = (Import-PowerShellDataFile -Path $DownloadsFolder\Manifest.psd1).ModuleVersion + # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json + $LatestRelease = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" | ConvertFrom-Json).Sophia_Script_Windows_10_LTSC $CurrentRelease = (Get-Module -Name Sophia).Version.ToString() - - Remove-Item -Path $DownloadsFolder\Manifest.psd1 -Force - switch ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) { $true @@ -695,6 +687,7 @@ function ScheduledTasks function DisableButton { + Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message $Localization.Patient -Verbose [void]$Window.Close() @@ -705,6 +698,7 @@ function ScheduledTasks function EnableButton { + Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message $Localization.Patient -Verbose [void]$Window.Close() @@ -769,6 +763,7 @@ function ScheduledTasks } } + Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message $Localization.Patient -Verbose # Getting list of all scheduled tasks according to the conditions @@ -3614,6 +3609,7 @@ function WindowsFeatures function DisableButton { + Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message $Localization.Patient -Verbose [void]$Window.Close() @@ -3624,6 +3620,7 @@ function WindowsFeatures function EnableButton { + Write-Information -MessageData "" -InformationAction Continue Write-Verbose -Message $Localization.Patient -Verbose [void]$Window.Close() @@ -4785,6 +4782,7 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int while ($k.Key -notin ([ConsoleKey]::Escape, [ConsoleKey]::Enter)) } + # Get the localized user folders names $Signature = @{ Namespace = "WinAPI" Name = "GetStr" @@ -4810,18 +4808,20 @@ public static string GetString(uint strId) Add-Type @Signature -Using System.Text } - $DesktopLocalizedString = [WinAPI.GetStr]::GetString(21769) + # The localized user folders names + $DesktopLocalizedString = [WinAPI.GetStr]::GetString(21769) $DocumentsLocalizedString = [WinAPI.GetStr]::GetString(21770) $DownloadsLocalizedString = [WinAPI.GetStr]::GetString(21798) - $MusicLocalizedString = [WinAPI.GetStr]::GetString(21790) - $PicturesLocalizedString = [WinAPI.GetStr]::GetString(21779) - $VideosLocalizedString = [WinAPI.GetStr]::GetString(21791) + $MusicLocalizedString = [WinAPI.GetStr]::GetString(21790) + $PicturesLocalizedString = [WinAPI.GetStr]::GetString(21779) + $VideosLocalizedString = [WinAPI.GetStr]::GetString(21791) switch ($PSCmdlet.ParameterSetName) { "Root" { Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose + Write-Information -MessageData "" -InformationAction Continue # Store all drives letters to use them within ShowMenu function $DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) @@ -4838,8 +4838,16 @@ public static string GetString(uint strId) # Desktop Write-Verbose -Message ($Localization.DriveSelect -f $DesktopLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $DesktopLocalizedString $Change = $Localization.Change @@ -4858,13 +4866,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Documents Write-Verbose -Message ($Localization.DriveSelect -f $DocumentsLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $DocumentsLocalizedString $Change = $Localization.Change @@ -4883,13 +4900,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Downloads Write-Verbose -Message ($Localization.DriveSelect -f $DownloadsLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $DownloadsLocalizedString $Change = $Localization.Change @@ -4908,13 +4934,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Music Write-Verbose -Message ($Localization.DriveSelect -f $MusicLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $MusicLocalizedString $Change = $Localization.Change @@ -4933,13 +4968,21 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Pictures Write-Verbose -Message ($Localization.DriveSelect -f $PicturesLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $PicturesLocalizedString $Change = $Localization.Change @@ -4958,13 +5001,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Videos Write-Verbose -Message ($Localization.DriveSelect -f $VideosLocalizedString) -Verbose + + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderRequest -f $VideosLocalizedString $Change = $Localization.Change @@ -4983,14 +5035,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } } "Custom" { # Desktop + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $DesktopLocalizedString $Browse = $Localization.Browse @@ -5021,12 +5081,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Documents + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $DocumentsLocalizedString $Browse = $Localization.Browse @@ -5057,12 +5125,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Downloads + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $DownloadsLocalizedString $Browse = $Localization.Browse @@ -5093,12 +5169,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Music + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $MusicLocalizedString $Browse = $Localization.Browse @@ -5129,12 +5213,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Pictures + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $PicturesLocalizedString $Browse = $Localization.Browse @@ -5165,12 +5257,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Videos + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserFolderSelect -f $VideosLocalizedString $Browse = $Localization.Browse @@ -5201,14 +5301,22 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } } "Default" { # Desktop + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Desktop + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $DesktopLocalizedString $Change = $Localization.Change @@ -5226,12 +5334,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Documents + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name Personal + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $DocumentsLocalizedString $Change = $Localization.Change @@ -5249,12 +5365,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Downloads + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $DownloadsLocalizedString $Change = $Localization.Change @@ -5272,12 +5396,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Music + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Music" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $MusicLocalizedString $Change = $Localization.Change @@ -5295,12 +5427,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Pictures + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $PicturesLocalizedString $Change = $Localization.Change @@ -5318,12 +5458,20 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } # Videos + $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Video" + Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose + + Write-Information -MessageData "" -InformationAction Continue + Write-Warning -Message $Localization.FilesWontBeMoved + Write-Information -MessageData "" -InformationAction Continue + $Title = "" $Message = $Localization.UserDefaultFolder -f $VideosLocalizedString $Change = $Localization.Change @@ -5341,6 +5489,7 @@ public static string GetString(uint strId) "1" { Write-Verbose -Message $Localization.Skipped -Verbose + Write-Information -MessageData "" -InformationAction Continue } } } @@ -6795,7 +6944,6 @@ function SetAppGraphicsPerformance .NOTES A native interactive toast notification pops up every 30 days - The task runs every 30 days .NOTES Current user @@ -7056,8 +7204,7 @@ while (`$true) SoftwareDistributionTask -Delete .NOTES - The task will wait until the Windows Updates service finishes running - The task runs every 90 days + The task will wait until the Windows Updates service finishes running. The task runs every 90 days .NOTES Current user @@ -7162,7 +7309,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For TempTask -Delete .NOTES - The task runs every 60 days + Only files older than one day will be deleted. The task runs every 60 days .NOTES Current user @@ -7543,7 +7690,7 @@ function CommandLineProcessAudit The "Process Creation" Event Viewer custom view .PARAMETER Enable - Create the "Process Creation" Event Viewer custom view + Create the "Process Creation" Event Viewer сustom view to log the executed processes and their arguments .PARAMETER Disable Remove the "Process Creation" Event Viewer custom view @@ -7555,7 +7702,7 @@ function CommandLineProcessAudit EventViewerCustomView -Disable .NOTES - In order this feature to work events auditing (ProcessAudit -Enable) and command line in process creation events will be enabled + In order this feature to work events auditing (ProcessAudit -Enable) and command line (CommandLineProcessAudit -Enable) in process creation events will be enabled .NOTES Machine-wide @@ -8942,6 +9089,7 @@ public static void PostMessage() Set-MpPreference -EnableControlledFolderAccess Enabled } + Write-Information -MessageData "" -InformationAction Continue Write-Warning -Message $Localization.RestartWarning [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null @@ -9008,10 +9156,16 @@ function Errors { if ($Global:Error) { + # Some errors may have the Windows nature and don't have a path to any of the module's files + $ErrorInFile = if ($_.InvocationInfo.PSCommandPath) + { + Split-Path -Path $_.InvocationInfo.PSCommandPath -Leaf + } + ($Global:Error | ForEach-Object -Process { [PSCustomObject]@{ - $Localization.ErrorsLine = $_.InvocationInfo.ScriptLineNumber - $Localization.ErrorsFile = Split-Path -Path $PSCommandPath -Leaf + $Localization.ErrorsLine = $_.InvocationInfo.ScriptLineNumber + $Localization.ErrorsFile = $ErrorInFile $Localization.ErrorsMessage = $_.Exception.Message } } | Sort-Object -Property Line | Format-Table -AutoSize -Wrap | Out-String).Trim() diff --git a/Sophia/LTSC/Sophia.ps1 b/Sophia/LTSC/Sophia.ps1 index 3229a047..ba38d87c 100644 --- a/Sophia/LTSC/Sophia.ps1 +++ b/Sophia/LTSC/Sophia.ps1 @@ -2,8 +2,8 @@ .SYNOPSIS Default preset file for "Sophia Script for Windows 10 LTSC" - Version: v5.2.12 - Date: 06.08.2021 + Version: v5.2.13 + Date: 25.08.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & Inestic @@ -71,7 +71,7 @@ param Clear-Host -$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC v5.2.12 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021" +$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC v5.2.13 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force @@ -531,10 +531,10 @@ WindowsManageDefaultPrinter -Disable <# Disable the Windows features using the pop-up dialog box - Отключить компоненты Windows, используя всплывающее диалоговое окно - If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not disable the "Media Features" feature + Если вы хотите оставить параметр "Параметры мультимедиа" в дополнительных параметрах схемы управления питанием, не отключайте "Компоненты для работы с медиа" + Отключить компоненты Windows, используя всплывающее диалоговое окно #> WindowsFeatures -Disable @@ -767,25 +767,18 @@ RunPowerShellShortcut -Elevated #endregion Start menu #region Gaming -<# - Choose an app and set the "High performance" graphics performance for it - Only with a dedicated GPU - - Выбрать приложение и установить параметры производительности графики на "Высокая производительность" для него - Только при наличии внешней видеокарты -#> +# Choose an app and set the "High performance" graphics performance for it. Only if you have a dedicated GPU +# Выбрать приложение и установить для него параметры производительности графики на "Высокая производительность". Только при наличии внешней видеокарты SetAppGraphicsPerformance #endregion Gaming #region Scheduled tasks <# Create the "Windows Cleanup" scheduled task for cleaning up Windows unused files and updates - A native interactive toast notification pops up every 30 days - The task runs every 30 days + A native interactive toast notification pops up every 30 days. The task runs every 30 days Создать задачу "Windows Cleanup" по очистке неиспользуемых файлов и обновлений Windows в Планировщике заданий - Нативный интерактивный тост всплывает каждые 30 дней - Задача выполняется каждые 30 дней + Нативный интерактивный тост всплывает каждые 30 дней. Задача выполняется каждые 30 дней #> CleanupTask -Register @@ -795,12 +788,10 @@ CleanupTask -Register <# Create the "SoftwareDistribution" scheduled task for cleaning up the %SystemRoot%\SoftwareDistribution\Download folder - The task will wait until the Windows Updates service finishes running - The task runs every 90 days + The task will wait until the Windows Updates service finishes running. The task runs every 90 days Создать задачу "SoftwareDistribution" по очистке папки %SystemRoot%\SoftwareDistribution\Download в Планировщике заданий - Задача будет ждать, пока служба обновлений Windows не закончит работу - Задача выполняется каждые 90 дней + Задача будет ждать, пока служба обновлений Windows не закончит работу. Задача выполняется каждые 90 дней #> SoftwareDistributionTask -Register @@ -810,10 +801,10 @@ SoftwareDistributionTask -Register <# Create the "Temp" scheduled task for cleaning up the %TEMP% folder - The task runs every 60 days + Only files older than one day will be deleted. The task runs every 60 days Создать задачу "Temp" в Планировщике заданий по очистке папки %TEMP% - Задача выполняется каждые 60 дней + Удаляться будут только файлы старше одного дня. Задача выполняется каждые 60 дней #> TempTask -Register @@ -882,16 +873,16 @@ CommandLineProcessAudit -Enable # CommandLineProcessAudit -Disable <# - Create "Process Creation" Event Viewer сustom view - In order this feature to work events auditing (AuditProcess -Enable) and command line in process creation events will be enabled + Create the "Process Creation" Event Viewer сustom view to log the executed processes and their arguments + In order this feature to work events auditing (AuditProcess -Enable) and command line (CommandLineProcessAudit -Enable) in process creation events will be enabled - Создать настаиваемое представление "Создание процесса" в Просмотре событий - Для того, чтобы работал данный функционал, буден включен аудит событий (AuditProcess -Enable) и командной строки в событиях создания процесса + Создать настраиваемое представление "Создание процесса" в Просмотре событий для журналирования запускаемых процессов и их аргументов + Для того, чтобы работал данный функционал, буден включен аудит событий (AuditProcess -Enable) и командной строки (CommandLineProcessAudit -Enable) в событиях создания процесса #> EventViewerCustomView -Enable -# Remove "Process Creation" Event Viewer Custom View (default value) -# Удалить настаиваемое представление "Создание процесса" в Просмотре событий (значение по умолчанию) +# Remove "Process Creation" Event Viewer сustom view to log the executed processes and their arguments (default value) +# Удалить настаиваемое представление "Создание процесса" в Просмотре событий для журналирования запускаемых процессов и их аргументов (значение по умолчанию) # EventViewerCustomView -Disable # Enable logging for all Windows PowerShell modules