From bb8b892a2bb94a13b2ec65a40a7779b2b542ffa6 Mon Sep 17 00:00:00 2001 From: Dmitry Nefedov Date: Thu, 22 Apr 2021 11:09:46 +0300 Subject: [PATCH] 22.04.2021 v5.10.2 --- Sophia/PowerShell 7/Functions.ps1 | 47 ++++++------- Sophia/PowerShell 7/Sophia.ps1 | 28 ++++---- Sophia/PowerShell 7/Sophia.psd1 | 2 +- Sophia/PowerShell 7/Sophia.psm1 | 99 ++++++++++++++------------- Sophia/PowerShell 7/cn-CN/Sophia.psd1 | 2 - Sophia/PowerShell 7/de-DE/Sophia.psd1 | 2 - Sophia/PowerShell 7/en-US/Sophia.psd1 | 2 - Sophia/PowerShell 7/es-ES/Sophia.psd1 | 2 - Sophia/PowerShell 7/fr-FR/Sophia.psd1 | 2 - Sophia/PowerShell 7/it-IT/Sophia.psd1 | 4 +- Sophia/PowerShell 7/pt-BR/Sophia.psd1 | 2 - Sophia/PowerShell 7/ru-RU/Sophia.psd1 | 4 +- Sophia/PowerShell 7/tr-TR/Sophia.psd1 | 2 - Sophia/PowerShell 7/uk-UA/Sophia.psd1 | 2 - 14 files changed, 89 insertions(+), 111 deletions(-) diff --git a/Sophia/PowerShell 7/Functions.ps1 b/Sophia/PowerShell 7/Functions.ps1 index 80457fbe..f2710fbc 100644 --- a/Sophia/PowerShell 7/Functions.ps1 +++ b/Sophia/PowerShell 7/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 7/Sophia.ps1 b/Sophia/PowerShell 7/Sophia.ps1 index 4f389e35..d16035b6 100644 --- a/Sophia/PowerShell 7/Sophia.ps1 +++ b/Sophia/PowerShell 7/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 7/Sophia.psd1 b/Sophia/PowerShell 7/Sophia.psd1 index 62453fd1..a2abeba1 100644 --- a/Sophia/PowerShell 7/Sophia.psd1 +++ b/Sophia/PowerShell 7/Sophia.psd1 @@ -1,6 +1,6 @@ @{ RootModule = 'Sophia.psm1' - ModuleVersion = '5.10.1' + ModuleVersion = '5.10.2' GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a' Author = 'Dmitry "farag" Nefedov' Copyright = '(c) 2015–2021 farag & oZ-Zo. All rights reserved.' diff --git a/Sophia/PowerShell 7/Sophia.psm1 b/Sophia/PowerShell 7/Sophia.psm1 index 455f4dc1..614e1489 100644 --- a/Sophia/PowerShell 7/Sophia.psm1 +++ b/Sophia/PowerShell 7/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 @@ -3809,11 +3809,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 } @@ -3927,11 +3927,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 } @@ -7796,6 +7796,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 @@ -8039,7 +8040,7 @@ public static string GetString(uint strId) .NOTES Load The WinRT.Runtime.dll and Microsoft.Windows.SDK.NET.dll assemblies to the current session in order to get localized UWP apps names - CsWinRT v1.2.2 + CsWinRT v1.2.5 Microsoft.Windows.SDK.NET 10.0.19041.16 .LINK @@ -8448,11 +8449,11 @@ function UninstallUWPApps RestoreUWPAppsUWPApps .NOTES - UWP apps can be restored only if they were uninstalled only for the current user + UWP apps can be restored only if they were uninstalled for the current user .NOTES Load The WinRT.Runtime.dll and Microsoft.Windows.SDK.NET.dll assemblies to the current session in order to get localized UWP apps names - CsWinRT v1.2.2 + CsWinRT v1.2.5 Microsoft.Windows.SDK.NET 10.0.19041.16 .LINK @@ -9170,7 +9171,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 @@ -9422,12 +9423,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 @@ -9481,9 +9482,9 @@ while (`$true) - + - + """@ @@ -9501,13 +9502,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 } @@ -9608,13 +9609,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 } @@ -9703,13 +9704,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 } @@ -11829,8 +11830,8 @@ public static void PostMessage() .NOTES Load The WinRT.Runtime.dll and Microsoft.Windows.SDK.NET.dll assemblies to the current session in order to get localized UWP apps names - CsWinRT v1.2.1 - Microsoft.Windows.SDK.NET 10.0.19041.15 + CsWinRT v1.2.5 + Microsoft.Windows.SDK.NET 10.0.19041.16 .LINK https://github.com/microsoft/CsWinRT @@ -11854,7 +11855,7 @@ public static void PostMessage()