From 23baf4cbf3aed37f8fbdc582932ec21bd7c0882e Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Thu, 22 Apr 2021 11:08:31 +0300 Subject: [PATCH] 22.04.2021 v5.2.2 --- Sophia/LTSC/Functions.ps1 | 47 ++++++++---------- Sophia/LTSC/Sophia.ps1 | 30 +++++++----- Sophia/LTSC/Sophia.psd1 | Bin 1772 -> 1772 bytes Sophia/LTSC/Sophia.psm1 | 90 +++++++++++++++++----------------- Sophia/LTSC/cn-CN/Sophia.psd1 | 2 - Sophia/LTSC/de-DE/Sophia.psd1 | 2 - Sophia/LTSC/en-US/Sophia.psd1 | 2 - Sophia/LTSC/es-ES/Sophia.psd1 | 2 - Sophia/LTSC/fr-FR/Sophia.psd1 | 2 - Sophia/LTSC/it-IT/Sophia.psd1 | 2 - Sophia/LTSC/pt-BR/Sophia.psd1 | 2 - Sophia/LTSC/ru-RU/Sophia.psd1 | 2 - Sophia/LTSC/tr-TR/Sophia.psd1 | 2 - Sophia/LTSC/uk-UA/Sophia.psd1 | 2 - 14 files changed, 85 insertions(+), 102 deletions(-) diff --git a/Sophia/LTSC/Functions.ps1 b/Sophia/LTSC/Functions.ps1 index b913ed15..1eb403a3 100644 --- a/Sophia/LTSC/Functions.ps1 +++ b/Sophia/LTSC/Functions.ps1 @@ -1,9 +1,9 @@ <# .SYNOPSIS - Run the specific function, using the TAB completion + The TAB completion for functions and their arguments - Version: v5.2.1 - Date: 14.04.2021 + Version: v5.2.2 + Date: 22.04.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & oZ-Zo @@ -11,14 +11,10 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - To be able to call the specific function(s) enter ". .\Function.ps1" first (with a dot at the beginning) - Running this script will add the TAB completion for functions and their arguments by typing its' first letters + Dot source the script first: . .\Function.ps1 (with a dot at the beginning) + Start typing any characters contained in the function's name or its arguments, and press the TAB button - Чтобы иметь возможность вызывать конкретную функцию, введите сначала ". .\Functions.ps1" (с точкой в начале) - Запуск этого скрипта добавит, используя табуляцию, автопродление имен функций и их аргументов по введенным первым буквам - - .EXAMPLE Run the specific function(s) - . .\Functions.ps1 + .EXAMPLE Sophia -Functions Sophia -Functions temp Sophia -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps @@ -57,10 +53,7 @@ function Sophia $Functions ) - <# - Regardless of the functions entered as an argument, the "Checkings" function will be executed first, - and the "Refresh" and "Errors" functions will be executed at the end - #> + # Regardless of the functions entered as an argument, the "Checkings" function will be executed first, and the "Refresh" and "Errors" functions will be executed at the end Invoke-Command -ScriptBlock {Checkings} foreach ($Function in $Functions) @@ -73,7 +66,7 @@ function Sophia Clear-Host -$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.10.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2014–2021" +$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.10.2 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2014–2021" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force @@ -99,25 +92,23 @@ $Parameters = @{ { $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames} - # If module command is PinToStart + # If a module command is PinToStart if ($Command -eq "PinToStart") { # Get all command arguments, excluding defaults foreach ($ParameterSet in $ParameterSets.Name) { - # If Argument is PinToStart + # If an argument is Tiles if ($ParameterSet -eq "Tiles") { - $ValidValues = ((Get-Command -Name PinToStart).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues + $ValidValues = ((Get-Command -Name PinToStart).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues foreach ($ValidValue in $ValidValues) { - # "PinToStart -Tites ControlPanel" construction - # "PinToStart -Tites DevicesPrinters" construction - # "PinToStart -Tites PowerShell" construction + # The "PinToStart -Tiles " construction "PinToStart" + " " + "-" + $ParameterSet + " " + $ValidValue | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""} } - # "PinToStart -Tites ControlPanel, DevicesPrinters, PowerShell" construction + # "PinToStart -Tiles " construction "PinToStart" + " " + "-" + $ParameterSet + " " + ($ValidValues -join ", ") | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""} } @@ -125,7 +116,7 @@ $Parameters = @{ } } - # If module command is UninstallUWPApps + # If a module command is UninstallUWPApps if ($Command -eq "UninstallUWPApps") { (Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} @@ -133,10 +124,10 @@ $Parameters = @{ # Get all command arguments, excluding defaults foreach ($ParameterSet in $ParameterSets.Name) { - # If Argument is ForAllUsers + # If an argument is ForAllUsers if ($ParameterSet -eq "ForAllUsers") { - # "UninstallUWPApps -ForAllUsers" construction + # The "UninstallUWPApps -ForAllUsers" construction "UninstallUWPApps" + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""} } @@ -146,12 +137,16 @@ $Parameters = @{ foreach ($ParameterSet in $ParameterSets.Name) { - # "Function -Argument" construction + # The "Function -Argument" construction $Command + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""} + + continue } # Get functions list without arguments to complete Get-Command -Name $Command | Where-Object -FilterScript {$null -eq $_.Parametersets.Parameters} | Where-Object -FilterScript {$_.Name -like "*$wordToComplete*"} + + continue } } } diff --git a/Sophia/LTSC/Sophia.ps1 b/Sophia/LTSC/Sophia.ps1 index 51a3528e..eefa6170 100644 --- a/Sophia/LTSC/Sophia.ps1 +++ b/Sophia/LTSC/Sophia.ps1 @@ -2,8 +2,8 @@ .SYNOPSIS Default preset file for "Windows 10 Sophia Script" (LTSC version) - Version: v5.2.1 - Date: 14.04.2021 + Version: v5.2.2 + Date: 22.04.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & oZ-Zo @@ -11,16 +11,10 @@ Thanks to all https://forum.ru-board.com members involved .DESCRIPTION - Read carefully and configure the preset file before running - Comment out function with the "#" char if you don't want it to be run - Uncomment function by removing the "#" char if you want it to be run + Place the "#" char before function if you don't want it to be run + Remove the "#" char before function if you want it to be run Every tweak in the preset file has its' corresponding function to restore the default settings - Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring - - To be able to call the specific function using autocompletion invoke the Functions.ps1: - . .\Functions.ps1 (with a dot at the beginning). Read more in the Functions.ps1 file - .EXAMPLE Run the whole script .\Sophia.ps1 @@ -38,13 +32,21 @@ Set execution policy to be able to run scripts only in the current PowerShell session: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + .NOTES + Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring + + .NOTES + To use the TAB completion for functions and their arguments dot source the Function.ps1 script first: + . .\Function.ps1 (with a dot at the beginning) + Read more in the Functions.ps1 file + .NOTES https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 https://habr.com/post/521202/ https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ - .LINK + .LINK Telegram channel & group https://t.me/sophianews https://t.me/sophia_chat @@ -69,7 +71,7 @@ param Clear-Host -$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script for LTSC v5.2.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2014–2021" +$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script for LTSC v5.2.2 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2014–2021" Remove-Module -Name Sophia -Force -ErrorAction Ignore Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force @@ -354,6 +356,10 @@ TrayIcons -Show # Просмотр иконок Панели управления как: крупные значки ControlPanelView -LargeIcons +# View the Control Panel icons by: small icons +# Просмотр иконок Панели управления как: маленькие значки +# ControlPanelView -SmallIcons + # View the Control Panel icons by: category (default value) # Просмотр иконок Панели управления как: категория (значение по умолчанию) # ControlPanelView -Category diff --git a/Sophia/LTSC/Sophia.psd1 b/Sophia/LTSC/Sophia.psd1 index 29c3e471d1826e78efac64b1cea6db1c1a2c650d..7729e3a0f1c1a02d69e57edcd442284b8f6d067f 100644 GIT binary patch delta 12 TcmaFE`-XSIG)AM1(?i(+Br62( delta 12 TcmaFE`-XSIG)BXX(?i(+Bqjvz diff --git a/Sophia/LTSC/Sophia.psm1 b/Sophia/LTSC/Sophia.psm1 index 85a5aa49..b697e2e6 100644 --- a/Sophia/LTSC/Sophia.psm1 +++ b/Sophia/LTSC/Sophia.psm1 @@ -2,15 +2,15 @@ .SYNOPSIS "Windows 10 Sophia Script" (LTSC version) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks - Version: v5.2.1 - Date: 14.04.2021 + Version: v5.2.2 + Date: 22.04.2021 Copyright (c) 2014–2021 farag Copyright (c) 2019–2021 farag & oZ-Zo Thanks to all https://forum.ru-board.com members involved - .DESCRIPTION + .NOTES Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring .NOTES @@ -273,10 +273,12 @@ function DiagnosticDataLevel { "Minimal" { + # Basic level New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 0 -Force } "Default" { + # Full level New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name AllowTelemetry -PropertyType DWord -Value 3 -Force } } @@ -2888,11 +2890,11 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Parameters = @{ - "TaskName" = "SymbolicLink" - "Principal" = $Principal - "Action" = $Action - "Settings" = $Settings - "Trigger" = $Trigger + TaskName = "SymbolicLink" + Principal = $Principal + Action = $Action + Settings = $Settings + Trigger = $Trigger } Register-ScheduledTask @Parameters -Force } @@ -3001,11 +3003,11 @@ Unregister-ScheduledTask -TaskName TemporaryTask -Confirm:`$false $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Parameters = @{ - "TaskName" = "TemporaryTask" - "Principal" = $Principal - "Action" = $Action - "Settings" = $Settings - "Trigger" = $Trigger + TaskName = "TemporaryTask" + Principal = $Principal + Action = $Action + Settings = $Settings + Trigger = $Trigger } Register-ScheduledTask @Parameters -Force } @@ -6580,7 +6582,7 @@ function SetAppGraphicsPerformance Add-Type -AssemblyName System.Windows.Forms $OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog $OpenFileDialog.Filter = $Localization.EXEFilesFilter - $OpenFileDialog.InitialDirectory = "${env:ProgramFiles(x86)}" + $OpenFileDialog.InitialDirectory = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" $OpenFileDialog.Multiselect = $false # Focus on open file dialog @@ -6767,12 +6769,12 @@ while (`$true) $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Parameters = @{ - "TaskName" = "Windows Cleanup" - "TaskPath" = "Sophia Script" - "Principal" = $Principal - "Action" = $Action - "Description" = $Localization.CleanupTaskDescription - "Settings" = $Settings + TaskName = "Windows Cleanup" + TaskPath = "Sophia Script" + Principal = $Principal + Action = $Action + Description = $Localization.CleanupTaskDescription + Settings = $Settings } Register-ScheduledTask @Parameters -Force @@ -6826,9 +6828,9 @@ while (`$true) - + - + """@ @@ -6846,13 +6848,13 @@ while (`$true) $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 30 -At 9pm $Parameters = @{ - "TaskName" = "Windows Cleanup Notification" - "TaskPath" = "Sophia Script" - "Principal" = $Principal - "Action" = $Action - "Description" = $Localization.CleanupNotificationTaskDescription - "Settings" = $Settings - "Trigger" = $Trigger + TaskName = "Windows Cleanup Notification" + TaskPath = "Sophia Script" + Principal = $Principal + Action = $Action + Description = $Localization.CleanupNotificationTaskDescription + Settings = $Settings + Trigger = $Trigger } Register-ScheduledTask @Parameters -Force } @@ -6953,13 +6955,13 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Parameters = @{ - "TaskName" = "SoftwareDistribution" - "TaskPath" = "Sophia Script" - "Principal" = $Principal - "Action" = $Action - "Description" = $Localization.FolderTaskDescription -f "%SystemRoot%\SoftwareDistribution\Download" - "Settings" = $Settings - "Trigger" = $Trigger + TaskName = "SoftwareDistribution" + TaskPath = "Sophia Script" + Principa = $Principal + Action = $Action + Description = $Localization.FolderTaskDescription -f "%SystemRoot%\SoftwareDistribution\Download" + Settings = $Settings + Trigger = $Trigger } Register-ScheduledTask @Parameters -Force } @@ -7048,13 +7050,13 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object {`$_.CreationTime $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Parameters = @{ - "TaskName" = "Temp" - "TaskPath" = "Sophia Script" - "Principal" = $Principal - "Action" = $Action - "Description" = $Localization.FolderTaskDescription -f "%TEMP%" - "Settings" = $Settings - "Trigger" = $Trigger + TaskName = "Temp" + TaskPath = "Sophia Script" + Principal = $Principal + Action = $Action + Description = $Localization.FolderTaskDescription -f "%TEMP%" + Settings = $Settings + Trigger = $Trigger } Register-ScheduledTask @Parameters -Force } @@ -9019,7 +9021,7 @@ public static void PostMessage()