From 109b04cf13157d914c4f530213d46c5b49f6dba1 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Thu, 22 Apr 2021 11:09:04 +0300 Subject: [PATCH] 22.04.2021 v5.10.2 --- Sophia/PowerShell 5.1/Functions.ps1 | 47 ++++++------- Sophia/PowerShell 5.1/Sophia.ps1 | 28 ++++---- Sophia/PowerShell 5.1/Sophia.psd1 | Bin 1774 -> 1774 bytes Sophia/PowerShell 5.1/Sophia.psm1 | 89 ++++++++++++------------ Sophia/PowerShell 5.1/cn-CN/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/de-DE/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/en-US/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/es-ES/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/fr-FR/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/it-IT/Sophia.psd1 | 4 +- Sophia/PowerShell 5.1/pt-BR/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/ru-RU/Sophia.psd1 | 4 +- Sophia/PowerShell 5.1/tr-TR/Sophia.psd1 | 2 - Sophia/PowerShell 5.1/uk-UA/Sophia.psd1 | 2 - 14 files changed, 83 insertions(+), 105 deletions(-) diff --git a/Sophia/PowerShell 5.1/Functions.ps1 b/Sophia/PowerShell 5.1/Functions.ps1 index 80457fbe..f2710fbc 100644 --- a/Sophia/PowerShell 5.1/Functions.ps1 +++ b/Sophia/PowerShell 5.1/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.10.1 - Date: 14.04.2021 + Version: v5.10.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/PowerShell 5.1/Sophia.ps1 b/Sophia/PowerShell 5.1/Sophia.ps1 index c73eabc4..174b5a7f 100644 --- a/Sophia/PowerShell 5.1/Sophia.ps1 +++ b/Sophia/PowerShell 5.1/Sophia.ps1 @@ -2,8 +2,8 @@ .SYNOPSIS Default preset file for "Windows 10 Sophia Script" - Version: v5.10.1 - Date: 14.04.2021 + Version: v5.10.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 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 @@ -451,7 +453,7 @@ ControlPanelView -LargeIcons # ControlPanelView -SmallIcons # View the Control Panel icons by: category (default value) -# Просмотр значки Панели управления как: категория (значение по умолчанию) +# Просмотр иконок Панели управления как: категория (значение по умолчанию) # ControlPanelView -Category # Set the Windows mode color scheme to the dark diff --git a/Sophia/PowerShell 5.1/Sophia.psd1 b/Sophia/PowerShell 5.1/Sophia.psd1 index 05c33839906af42f796ee69d8b0d760b93192442..9d3f1d7253cfce7e2448b8f88c021da4440d12d3 100644 GIT binary patch delta 12 TcmaFI`;K?Q3`V1kGeg+`Bx?ls delta 12 TcmaFI`;K?Q3`WC^Geg+`BxVHm diff --git a/Sophia/PowerShell 5.1/Sophia.psm1 b/Sophia/PowerShell 5.1/Sophia.psm1 index 88287b6d..8a1724a6 100644 --- a/Sophia/PowerShell 5.1/Sophia.psm1 +++ b/Sophia/PowerShell 5.1/Sophia.psm1 @@ -2,15 +2,15 @@ .SYNOPSIS "Windows 10 Sophia Script" is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks - Version: v5.10.1 - Date: 14.04.2021 + Version: v5.10.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 @@ -3800,11 +3800,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 } @@ -3913,11 +3913,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 } @@ -7783,6 +7783,7 @@ function PinToStart # Unpin all the Start tiles if ($UnpinAll) { + # Export the current Start layout Export-StartLayout -Path $Script:StartLayout -UseDesktopApplicationID [xml]$XML = Get-Content -Path $Script:StartLayout -Encoding UTF8 -Force @@ -9134,7 +9135,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 @@ -9386,12 +9387,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 @@ -9445,9 +9446,9 @@ while (`$true) - + - + """@ @@ -9465,13 +9466,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 } @@ -9572,13 +9573,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 } @@ -9667,13 +9668,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 } @@ -11809,7 +11810,7 @@ public static void PostMessage()