Browse Source

14.04.2021 v5.10.1

pull/174/head
Dmitry Nefedov 4 years ago
committed by GitHub
parent
commit
f6c9318099
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 70
      Sophia/PowerShell 5.1/Functions.ps1
  2. 104
      Sophia/PowerShell 5.1/Sophia.ps1
  3. BIN
      Sophia/PowerShell 5.1/Sophia.psd1
  4. 117
      Sophia/PowerShell 5.1/Sophia.psm1

70
Sophia/PowerShell 5.1/Functions.ps1

@ -2,9 +2,11 @@
.SYNOPSIS .SYNOPSIS
Run the specific function, using the TAB completion Run the specific function, using the TAB completion
Version: v5.10 Version: v5.10.1
Date: 09.04.2021 Date: 14.04.2021
Copyright (c) 20152021 farag & oZ-Zo
Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & oZ-Zo
Thanks to all https://forum.ru-board.com members involved Thanks to all https://forum.ru-board.com members involved
@ -71,7 +73,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.10 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021" $Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.10.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force
@ -95,25 +97,69 @@ $Parameters = @{
$Commands = (Get-Module -Name Sophia).ExportedCommands.Keys $Commands = (Get-Module -Name Sophia).ExportedCommands.Keys
foreach ($Command in $Commands) foreach ($Command in $Commands)
{ {
$UnnecessaryParameters = @("Verbose", "Debug", "ErrorAction", "WarningAction", "InformationAction", "ErrorVariable", "WarningVariable", "InformationVariable", "OutVariable", "OutBuffer", "PipelineVariable") $ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}
$ParameterSets = ((Get-Command -Name $Command).Parameters | Where-Object -FilterScript {$_.Keys}).Keys | Where-Object -FilterScript {$_ -notin $UnnecessaryParameters}
foreach ($ParameterSet in $ParameterSets) # If module command is PinToStart
if ($Command -eq "PinToStart")
{ {
# "Function -Argument" construction # Get all command arguments, excluding defaults
$Command + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -match $wordToComplete} | ForEach-Object -Process {"`"$_`""} foreach ($ParameterSet in $ParameterSets.Name)
{
# If Argument is PinToStart
if ($ParameterSet -eq "Tiles")
{
$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
"PinToStart" + " " + "-" + $ParameterSet + " " + $ValidValue | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
# "PinToStart -Tites ControlPanel, DevicesPrinters, PowerShell" construction
"PinToStart" + " " + "-" + $ParameterSet + " " + ($ValidValues -join ", ") | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
continue
}
}
# If module command is UninstallUWPApps
if ($Command -eq "UninstallUWPApps")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}
# Get all command arguments, excluding defaults
foreach ($ParameterSet in $ParameterSets.Name)
{
# If Argument is ForAllUsers
if ($ParameterSet -eq "ForAllUsers")
{
# "UninstallUWPApps -ForAllUsers" construction
"UninstallUWPApps" + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
} }
continue continue
} }
}
foreach ($ParameterSet in $ParameterSets.Name)
{
# "Function -Argument" construction
$Command + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
# Get functions list without arguments to complete # Get functions list without arguments to complete
(Get-Command -Name @((Get-Module -Name Sophia).ExportedCommands.Keys)) | Where-Object -FilterScript { Get-Command -Name $Command | Where-Object -FilterScript {$null -eq $_.Parametersets.Parameters} | Where-Object -FilterScript {$_.Name -like "*$wordToComplete*"}
$_.CmdletBinding -eq $false }
} | Where-Object -FilterScript {$_.Name -match $wordToComplete}
} }
} }
Register-ArgumentCompleter @Parameters Register-ArgumentCompleter @Parameters
Write-Information -MessageData "`n" -InformationAction Continue
Write-Verbose -Message "Sophia -Functions <tab>" -Verbose Write-Verbose -Message "Sophia -Functions <tab>" -Verbose
Write-Verbose -Message "Sophia -Functions temp<tab>" -Verbose Write-Verbose -Message "Sophia -Functions temp<tab>" -Verbose
Write-Verbose -Message "Sophia -Functions `"DiagTrackService -Disable`", `"DiagnosticDataLevel -Minimal`", UninstallUWPApps" -Verbose Write-Verbose -Message "Sophia -Functions `"DiagTrackService -Disable`", `"DiagnosticDataLevel -Minimal`", UninstallUWPApps" -Verbose
Write-Information -MessageData "`n" -InformationAction Continue
Write-Verbose -Message "UninstallUWPApps, `"PinToStart -UnpinAll`"" -Verbose

104
Sophia/PowerShell 5.1/Sophia.ps1

@ -2,9 +2,11 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Windows 10 Sophia Script" Default preset file for "Windows 10 Sophia Script"
Version: v5.10 Version: v5.10.1
Date: 09.04.2021 Date: 14.04.2021
Copyright (c) 20152021 farag & oZ-Zo
Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & oZ-Zo
Thanks to all https://forum.ru-board.com members involved Thanks to all https://forum.ru-board.com members involved
@ -16,15 +18,18 @@
Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring 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 enter ". .\Functions.ps1" (with a dot at the beginning) To be able to call the specific function using autocompletion invoke the Functions.ps1:
Read more in the Functions.ps1 file . .\Functions.ps1 (with a dot at the beginning). Read more in the Functions.ps1 file
.EXAMPLE Run the whole script .EXAMPLE Run the whole script
.\Sophia.ps1 .\Sophia.ps1
.EXAMPLE Run the script by specifying the module functions as an argument
.\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
.NOTES .NOTES
Supported Windows 10 versions Supported Windows 10 versions
Versions: 2004 (20H1)/20H2 (2009)/21H1 Versions: 2004/20H2/21H1
Builds: 19041/19042/19043 Builds: 19041/19042/19043
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
Architecture: x64 Architecture: x64
@ -54,15 +59,50 @@
#Requires -RunAsAdministrator #Requires -RunAsAdministrator
#Requires -Version 5.1 #Requires -Version 5.1
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
[string[]]
$Functions
)
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script v5.10 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021" $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"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force
Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia
<#
.SYNOPSIS
Run the script by specifying the module functions as an argument
Запустить скрипт, указав в качестве аргумента функции модуля
.EXAMPLE
.\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
.NOTES
Separate functions with a comma
#>
if ($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
Invoke-Command -ScriptBlock {Checkings}
foreach ($Function in $Functions)
{
Invoke-Expression -Command $Function
}
Invoke-Command -ScriptBlock {Refresh; Errors}
exit
}
#region Protection #region Protection
<# <#
Checkings Checkings
@ -88,12 +128,12 @@ CreateRestorePoint
#endregion Protection #endregion Protection
#region Privacy & Telemetry #region Privacy & Telemetry
# Disable the DiagTrack service, firewall rule for Unified Telemetry Client Outbound Traffic and block connection # Disable the DiagTrack service, and block connection for the Unified Telemetry Client Outbound Traffic
# Отключить службу DiagTrack, правила брандмауэра для исходящего трафик клиента единой телеметрии и заблокировать соединение # Отключить службу DiagTrack и заблокировать соединение для исходящего трафик клиента единой телеметрии
DiagTrackService -Disable DiagTrackService -Disable
# Enable the DiagTrack service, firewall rule for Unified Telemetry Client Outbound Traffic and allow connection # Enable the DiagTrack service, and allow connection for the Unified Telemetry Client Outbound Traffic
# Включить службу DiagTrack, правила брандмауэра для исходящего трафик клиента единой телеметрии и разрешить соединение # Включить службу DiagTrack и разрешить соединение для исходящего трафик клиента единой телеметрии
# DiagTrackService -Enable # DiagTrackService -Enable
# Set the OS level of diagnostic data gathering to minimum # Set the OS level of diagnostic data gathering to minimum
@ -105,7 +145,7 @@ DiagnosticDataLevel -Minimal
# DiagnosticDataLevel -Default # DiagnosticDataLevel -Default
# Turn off the Windows Error Reporting # Turn off the Windows Error Reporting
# Отключить отчеты об ошибках Windows # Отключить запись отчетов об ошибках Windows
ErrorReporting -Disable ErrorReporting -Disable
# Turn on the Windows Error Reporting (default value) # Turn on the Windows Error Reporting (default value)
@ -262,7 +302,7 @@ MergeConflicts -Show
# Открывать проводник для: "Этот компьютер" # Открывать проводник для: "Этот компьютер"
OpenFileExplorerTo -ThisPC OpenFileExplorerTo -ThisPC
# Open File Explorer to: "Quick access" (default value) # Open File Explorer to: Quick access (default value)
# Открывать проводник для: "Быстрый доступ" (значение по умолчанию) # Открывать проводник для: "Быстрый доступ" (значение по умолчанию)
# OpenFileExplorerTo -QuickAccess # OpenFileExplorerTo -QuickAccess
@ -311,15 +351,15 @@ SecondsInSystemClock -Show
SnapAssist -Disable SnapAssist -Disable
# When I snap a window, show what I can snap next to it (default value) # When I snap a window, show what I can snap next to it (default value)
# При прикреплении окна не показывать/показывать, что можно прикрепить рядом с ним (значение по умолчанию) # При прикреплении окна показывать, что можно прикрепить рядом с ним (значение по умолчанию)
# SnapAssist -Enable # SnapAssist -Enable
# Always open the file transfer dialog box in the detailed mode # Show the file transfer dialog box in the detailed mode
# Всегда открывать диалоговое окно передачи файлов в развернутом виде # Отображать диалоговое окно передачи файлов в развернутом виде
FileTransferDialog -Detailed FileTransferDialog -Detailed
# Always open the file transfer dialog box in the compact mode (default value) # Show the file transfer dialog box in the compact mode (default value)
# Всегда открывать диалоговое окно передачи файлов в свернутом виде (значение по умолчанию) # Отображать диалоговое окно передачи файлов в свернутом виде (значение по умолчанию)
# FileTransferDialog -Compact # FileTransferDialog -Compact
# Expand the File Explorer ribbon # Expand the File Explorer ribbon
@ -330,28 +370,28 @@ FileExplorerRibbon -Expanded
# Свернуть ленту проводника (значение по умолчанию) # Свернуть ленту проводника (значение по умолчанию)
# FileExplorerRibbon -Minimized # FileExplorerRibbon -Minimized
# Display the recycle bin files delete confirmation # Display the recycle bin files delete confirmation dialog
# Запрашивать подтверждение на удаление файлов в корзину # Запрашивать подтверждение на удаление файлов в корзину
RecycleBinDeleteConfirmation -Enable RecycleBinDeleteConfirmation -Enable
# Do not display the recycle bin files delete confirmation (default value) # Do not display the recycle bin files delete confirmation dialog (default value)
# Не запрашивать подтверждение на удаление файлов в корзину (значение по умолчанию) # Не запрашивать подтверждение на удаление файлов в корзину (значение по умолчанию)
# RecycleBinDeleteConfirmation -Disable # RecycleBinDeleteConfirmation -Disable
# Hide the "3D Objects" folder in "This PC" and "Quick access" # Hide the "3D Objects" folder in "This PC" and Quick access
# Скрыть папку "Объемные объекты" в "Этот компьютер" и панели быстрого доступа # Скрыть папку "Объемные объекты" в "Этот компьютер" и панели быстрого доступа
3DObjects -Hide 3DObjects -Hide
# Show the "3D Objects" folder in "This PC" and "Quick access" (default value) # Show the "3D Objects" folder in "This PC" and Quick access (default value)
# Отобразить папку "Объемные объекты" в "Этот компьютер" и панели быстрого доступа (значение по умолчанию) # Отобразить папку "Объемные объекты" в "Этот компьютер" и панели быстрого доступа (значение по умолчанию)
# 3DObjects -Show # 3DObjects -Show
# Hide frequently used folders in "Quick access" # Hide frequently used folders in Quick access
# Скрыть недавно используемые папки на панели быстрого доступа # Скрыть недавно используемые папки на панели быстрого доступа
QuickAccessFrequentFolders -Hide QuickAccessFrequentFolders -Hide
# Show frequently used folders in "Quick access" (default value) # Show frequently used folders in Quick access (default value)
# Показать недавно используемые папки на панели быстрого доступа (значение по умолчанию) # Показать часто используемые папки на панели быстрого доступа (значение по умолчанию)
# QuickAccessFrequentFolders -Show # QuickAccessFrequentFolders -Show
# Do not show recently used files in Quick access # Do not show recently used files in Quick access
@ -374,11 +414,11 @@ TaskbarSearch -Hide
# Показать поле поиска на панели задач (значение по умолчанию) # Показать поле поиска на панели задач (значение по умолчанию)
# TaskbarSearch -SearchBox # TaskbarSearch -SearchBox
# Do not show the "Windows Ink Workspace" button on the taskbar # Do not show the Windows Ink Workspace button on the taskbar
# Не показывать кнопку Windows Ink Workspace на панели задач # Не показывать кнопку Windows Ink Workspace на панели задач
WindowsInkWorkspace -Hide WindowsInkWorkspace -Hide
# Show the "Windows Ink Workspace" button in taskbar (default value) # Show Windows Ink Workspace button on the taskbar (default value)
# Показать кнопку Windows Ink Workspace на панели задач (значение по умолчанию) # Показать кнопку Windows Ink Workspace на панели задач (значение по умолчанию)
# WindowsInkWorkspace -Show # WindowsInkWorkspace -Show
@ -411,7 +451,7 @@ ControlPanelView -LargeIcons
# ControlPanelView -SmallIcons # ControlPanelView -SmallIcons
# View the Control Panel icons by: category (default value) # View the Control Panel icons by: category (default value)
# Просмотр значки Панели управления как "категория" (значение по умолчанию) # Просмотр значки Панели управления как: категория (значение по умолчанию)
# ControlPanelView -Category # ControlPanelView -Category
# Set the Windows mode color scheme to the dark # Set the Windows mode color scheme to the dark
@ -422,12 +462,12 @@ WindowsColorScheme -Dark
# Установить режим цвета для Windows на светлый # Установить режим цвета для Windows на светлый
# WindowsColorScheme -Light # WindowsColorScheme -Light
# Set the default app mode color scheme to the dark # Set the app mode color scheme to the dark
# Установить цвет режима приложений по умолчанию на темный # Установить цвет режима приложений на темный
AppMode -Dark AppMode -Dark
# Set the default app mode color scheme to the light # Set the app mode color scheme to the light
# Установить цвет режима приложений по умолчанию на светлый # Установить цвет режима приложений на светлый
# AppMode -Light # AppMode -Light
# Do not show the "New App Installed" indicator # Do not show the "New App Installed" indicator

BIN
Sophia/PowerShell 5.1/Sophia.psd1

Binary file not shown.

117
Sophia/PowerShell 5.1/Sophia.psm1

@ -2,9 +2,11 @@
.SYNOPSIS .SYNOPSIS
"Windows 10 Sophia Script" is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks "Windows 10 Sophia Script" is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version: v5.10 Version: v5.10.1
Date: 08.04.2021 Date: 14.04.2021
Copyright (c) 20152021 farag & oZ-Zo
Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & oZ-Zo
Thanks to all https://forum.ru-board.com members involved Thanks to all https://forum.ru-board.com members involved
@ -13,7 +15,7 @@
.NOTES .NOTES
Supported Windows 10 versions Supported Windows 10 versions
Versions: 2004 (20H1)/20H2 (2009)/21H1 Versions: 2004/20H2/21H1
Builds: 19041/19042/19043 Builds: 19041/19042/19043
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
Architecture: x64 Architecture: x64
@ -161,13 +163,13 @@ function CreateRestorePoint
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
.SYNOPSIS .SYNOPSIS
Configure the DiagTrack service, firewall rule for Unified Telemetry Client Outbound Traffic and block connection Configure the DiagTrack service, and connection for the Unified Telemetry Client Outbound Traffic
.PARAMETER Disable .PARAMETER Disable
Disable the DiagTrack service, firewall rule for Unified Telemetry Client Outbound Traffic and block connection Disable the DiagTrack service, and block connection for the Unified Telemetry Client Outbound Traffic
.PARAMETER Enable .PARAMETER Enable
Enable the DiagTrack service, firewall rule for Unified Telemetry Client Outbound Traffic and allow connection Enable the DiagTrack service, and allow connection for the Unified Telemetry Client Outbound Traffic
.EXAMPLE .EXAMPLE
DiagTrackService -Disable DiagTrackService -Disable
@ -204,7 +206,7 @@ function DiagTrackService
Get-Service -Name DiagTrack | Set-Service -StartupType Automatic Get-Service -Name DiagTrack | Set-Service -StartupType Automatic
Get-Service -Name DiagTrack | Start-Service Get-Service -Name DiagTrack | Start-Service
# Enable firewall rule for Unified Telemetry Client Outbound Traffic and allow connection # Allow connection for the Unified Telemetry Client Outbound Traffic
Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled True -Action Allow Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled True -Action Allow
} }
"Disable" "Disable"
@ -212,7 +214,7 @@ function DiagTrackService
Get-Service -Name DiagTrack | Stop-Service -Force Get-Service -Name DiagTrack | Stop-Service -Force
Get-Service -Name DiagTrack | Set-Service -StartupType Disabled Get-Service -Name DiagTrack | Set-Service -StartupType Disabled
# Disable firewall rule for Unified Telemetry Client Outbound Traffic and block connection # Block connection for the Unified Telemetry Client Outbound Traffic
Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled False -Action Block Get-NetFirewallRule -Group DiagTrack | Set-NetFirewallRule -Enabled False -Action Block
} }
} }
@ -1522,7 +1524,7 @@ function MergeConflicts
Open File Explorer to "This PC" Open File Explorer to "This PC"
.PARAMETER QuickAccess .PARAMETER QuickAccess
Open File Explorer to "Quick access" Open File Explorer to Quick access
.EXAMPLE .EXAMPLE
OpenFileExplorerTo -ThisPC OpenFileExplorerTo -ThisPC
@ -1881,13 +1883,13 @@ function SnapAssist
<# <#
.SYNOPSIS .SYNOPSIS
Configure the file transfer dialog box Configure the file transfer dialog box mode
.PARAMETER Detailed .PARAMETER Detailed
Always open the file transfer dialog box in the detailed mode Show the file transfer dialog box in the detailed mode
.PARAMETER Compact .PARAMETER Compact
Always open the file transfer dialog box in the compact mode Show the file transfer dialog box in the compact mode
.EXAMPLE .EXAMPLE
FileTransferDialog -Detailed FileTransferDialog -Detailed
@ -1999,13 +2001,13 @@ function FileExplorerRibbon
<# <#
.SYNOPSIS .SYNOPSIS
Configure the recycle bin files delete confirmation Configure the recycle bin files delete confirmation dialog
.PARAMETER Disable .PARAMETER Disable
Display/do not display the recycle bin files delete confirmation Display/do not display the recycle bin files delete confirmation dialog
.PARAMETER Enable .PARAMETER Enable
Display/do not display the recycle bin files delete confirmation Display/do not display the recycle bin files delete confirmation dialog
.EXAMPLE .EXAMPLE
RecycleBinDeleteConfirmation -Disable RecycleBinDeleteConfirmation -Disable
@ -2081,13 +2083,13 @@ public static void PostMessage()
<# <#
.SYNOPSIS .SYNOPSIS
Configure the "3D Objects" folder in "This PC" and "Quick access" Configure the "3D Objects" folder in "This PC" and Quick access
.PARAMETER Show .PARAMETER Show
Show the "3D Objects" folder in "This PC" and "Quick access" Show the "3D Objects" folder in "This PC" and Quick access
.PARAMETER Hide .PARAMETER Hide
Hide the "3D Objects" folder in "This PC" and "Quick access" Hide the "3D Objects" folder in "This PC" and Quick access
.EXAMPLE .EXAMPLE
3DObjects -Show 3DObjects -Show
@ -2154,13 +2156,13 @@ function 3DObjects
<# <#
.SYNOPSIS .SYNOPSIS
Configure frequently used folders in "Quick access" Configure frequently used folders in Quick access
.PARAMETER Show .PARAMETER Show
Show frequently used folders in "Quick access" Show frequently used folders in Quick access
.PARAMETER Hide .PARAMETER Hide
Hide frequently used folders in "Quick access" Hide frequently used folders in Quick access
.EXAMPLE .EXAMPLE
QuickAccessFrequentFolders -Show QuickAccessFrequentFolders -Show
@ -2324,13 +2326,13 @@ function TaskbarSearch
<# <#
.SYNOPSIS .SYNOPSIS
Configure the "Windows Ink Workspace" button on the taskbar Configure the Windows Ink Workspace button on the taskbar
.PARAMETER Show .PARAMETER Show
Show the "Windows Ink Workspace" button on the taskbar Show the Windows Ink Workspace button on the taskbar
.PARAMETER Hide .PARAMETER Hide
Hide the "Windows Ink Workspace" button on the taskbar Hide the Windows Ink Workspace button on the taskbar
.EXAMPLE .EXAMPLE
WindowsInkWorkspace -Show WindowsInkWorkspace -Show
@ -2689,10 +2691,10 @@ function WindowsColorScheme
Configure the default app mode color scheme Configure the default app mode color scheme
.PARAMETER Light .PARAMETER Light
Set the default app mode color scheme to the light Set the app mode color scheme to the light
.PARAMETER Dark .PARAMETER Dark
Set the default app mode color scheme to the dark Set the app mode color scheme to the dark
.EXAMPLE .EXAMPLE
AppMode -Light AppMode -Light
@ -7766,25 +7768,24 @@ function PinToStart
$UnpinAll, $UnpinAll,
[Parameter( [Parameter(
Mandatory = $true, Mandatory = $false,
Position = 1 Position = 1
)] )]
[ValidateSet("ControlPanel", "DevicesPrinters", "PowerShell")] [ValidateSet("ControlPanel", "DevicesPrinters", "PowerShell")]
[string[]] [string[]]
$Tiles, $Tiles
[string]
$StartLayout = "$PSScriptRoot\StartLayout.xml"
) )
begin begin
{ {
$Script:StartLayout = "$PSScriptRoot\StartLayout.xml"
# Unpin all the Start tiles # Unpin all the Start tiles
if ($UnpinAll) if ($UnpinAll)
{ {
Export-StartLayout -Path $StartLayout -UseDesktopApplicationID Export-StartLayout -Path $Script:StartLayout -UseDesktopApplicationID
[xml]$XML = Get-Content -Path $StartLayout -Encoding UTF8 -Force [xml]$XML = Get-Content -Path $Script:StartLayout -Encoding UTF8 -Force
$Groups = $XML.LayoutModificationTemplate.DefaultLayoutOverride.StartLayoutCollection.StartLayout.Group $Groups = $XML.LayoutModificationTemplate.DefaultLayoutOverride.StartLayoutCollection.StartLayout.Group
foreach ($Group in $Groups) foreach ($Group in $Groups)
@ -7793,7 +7794,7 @@ function PinToStart
$Group.ParentNode.RemoveChild($Group) | Out-Null $Group.ParentNode.RemoveChild($Group) | Out-Null
} }
$XML.Save($StartLayout) $XML.Save($Script:StartLayout)
} }
} }
@ -7828,8 +7829,22 @@ public static string GetString(uint strId)
# Extract the localized "Devices and Printers" string from shell32.dll # Extract the localized "Devices and Printers" string from shell32.dll
$DevicesPrinters = [WinAPI.GetStr]::GetString(30493) $DevicesPrinters = [WinAPI.GetStr]::GetString(30493)
# Check if an argument is "DevicesPrinters". The Devices and Printers's AppID attribute can be retrieved only if the shortcut was created
if (((Get-Command -Name PinToStart).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Where-Object -FilterScript {$_ -match "DevicesPrinters"})
{
# Create the old-style "Devices and Printers" shortcut in the Start menu
$Shell = New-Object -ComObject Wscript.Shell
$Shortcut = $Shell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesPrinters.lnk")
$Shortcut.TargetPath = "control"
$Shortcut.Arguments = "printers"
$Shortcut.IconLocation = "$env:SystemRoot\system32\DeviceCenter.dll"
$Shortcut.Save()
Start-Sleep -Seconds 3
}
# Get the AppID because it's auto generated AppID for the "Devices and Printers" shortcut # Get the AppID because it's auto generated AppID for the "Devices and Printers" shortcut
$Script:DevicesPrintersAppID = (Get-StartApps | Where-Object -FilterScript {$_.Name -eq $DevicesPrinters}).AppID $DevicesPrintersAppID = (Get-StartApps | Where-Object -FilterScript {$_.Name -eq $DevicesPrinters}).AppID
$Parameters = @( $Parameters = @(
# Control Panel hash table # Control Panel hash table
@ -7848,7 +7863,7 @@ public static string GetString(uint strId)
Size = "2x2" Size = "2x2"
Column = 2 Column = 2
Row = 0 Row = 0
AppID = $Script:DevicesPrintersAppID AppID = $DevicesPrintersAppID
}, },
# Windows PowerShell hash table # Windows PowerShell hash table
@{ @{
@ -7893,13 +7908,13 @@ public static string GetString(uint strId)
$Table $Table
} }
if (-not (Test-Path -Path $StartLayout)) if (-not (Test-Path -Path $Script:StartLayout))
{ {
# Export the current Start layout # Export the current Start layout
Export-StartLayout -Path $StartLayout -UseDesktopApplicationID Export-StartLayout -Path $Script:StartLayout -UseDesktopApplicationID
} }
[xml]$XML = Get-Content -Path $StartLayout -Encoding UTF8 -Force [xml]$XML = Get-Content -Path $Script:StartLayout -Encoding UTF8 -Force
foreach ($Tile in $Tiles) foreach ($Tile in $Tiles)
{ {
@ -7913,16 +7928,6 @@ public static string GetString(uint strId)
DevicesPrinters DevicesPrinters
{ {
Write-Verbose -Message ($Localization.ShortcutPinning -f $DevicesPrinters) -Verbose Write-Verbose -Message ($Localization.ShortcutPinning -f $DevicesPrinters) -Verbose
# Create the old-style "Devices and Printers" shortcut in the Start menu
$Shell = New-Object -ComObject Wscript.Shell
$Shortcut = $Shell.CreateShortcut("$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesPrinters.lnk")
$Shortcut.TargetPath = "control"
$Shortcut.Arguments = "printers"
$Shortcut.IconLocation = "$env:SystemRoot\system32\DeviceCenter.dll"
$Shortcut.Save()
Start-Sleep -Seconds 3
} }
PowerShell PowerShell
{ {
@ -7962,7 +7967,7 @@ public static string GetString(uint strId)
} }
} }
$XML.Save($StartLayout) $XML.Save($Script:StartLayout)
} }
end end
@ -7973,7 +7978,7 @@ public static string GetString(uint strId)
New-Item -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force New-Item -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
} }
New-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name LockedStartLayout -Value 1 -Force New-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name LockedStartLayout -Value 1 -Force
New-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name StartLayoutFile -Value $StartLayout -Force New-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name StartLayoutFile -Value $Script:StartLayout -Force
Start-Sleep -Seconds 3 Start-Sleep -Seconds 3
@ -7992,7 +7997,7 @@ public static string GetString(uint strId)
Remove-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name LockedStartLayout -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name LockedStartLayout -Force -ErrorAction Ignore
Remove-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name StartLayoutFile -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name StartLayoutFile -Force -ErrorAction Ignore
Remove-Item -Path $StartLayout -Force Remove-Item -Path $Script:StartLayout -Force
Stop-Process -Name StartMenuExperienceHost -Force -ErrorAction Ignore Stop-Process -Name StartMenuExperienceHost -Force -ErrorAction Ignore
@ -8129,7 +8134,7 @@ function UninstallUWPApps
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="Window" Name="Window"
MinHeight="400" MinWidth="410" MinHeight="400" MinWidth="415"
SizeToContent="Width" WindowStartupLocation="CenterScreen" SizeToContent="Width" WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True" TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True"
FontFamily="Candara" FontSize="16" ShowInTaskbar="True"> FontFamily="Candara" FontSize="16" ShowInTaskbar="True">
@ -8418,7 +8423,7 @@ function UninstallUWPApps
RestoreUWPAppsUWPApps RestoreUWPAppsUWPApps
.NOTES .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 .NOTES
A pop-up dialog box enables the user to select packages A pop-up dialog box enables the user to select packages
@ -8513,7 +8518,7 @@ function RestoreUWPApps
#region Functions #region Functions
function Get-AppxManifest function Get-AppxManifest
{ {
Write-Verbose -Message "Patient" -Verbose Write-Verbose -Message $Localization.Patient -Verbose
# Тут нельзя напрямую вписать -PackageTypeFilter Bundle, так как иначе не выдается нужное свойство InstallLocation. Только сравнивать с $Bundles # Тут нельзя напрямую вписать -PackageTypeFilter Bundle, так как иначе не выдается нужное свойство InstallLocation. Только сравнивать с $Bundles
$Bundles = (Get-AppXPackage -PackageTypeFilter Bundle -AllUsers).Name $Bundles = (Get-AppXPackage -PackageTypeFilter Bundle -AllUsers).Name

Loading…
Cancel
Save