Browse Source

14.04.2021 v5.2.1

pull/174/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
27394f242c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 74
      Sophia/LTSC/Functions.ps1
  2. 94
      Sophia/LTSC/Sophia.ps1
  3. BIN
      Sophia/LTSC/Sophia.psd1
  4. 95
      Sophia/LTSC/Sophia.psm1

74
Sophia/LTSC/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.2.1
Date: 09.04.2021 Date: 12.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")
{
# Get all command arguments, excluding defaults
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
}
}
foreach ($ParameterSet in $ParameterSets.Name)
{ {
# "Function -Argument" construction # "Function -Argument" construction
$Command + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -match $wordToComplete} | ForEach-Object -Process {"`"$_`""} $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*"}
} }
# Get functions list without arguments to complete
(Get-Command -Name @((Get-Module -Name Sophia).ExportedCommands.Keys)) | Where-Object -FilterScript {
$_.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

94
Sophia/LTSC/Sophia.ps1

@ -2,26 +2,31 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Windows 10 Sophia Script" (LTSC version) Default preset file for "Windows 10 Sophia Script" (LTSC version)
Version: v5.2 Version: v5.2.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
.DESCRIPTION .DESCRIPTION
Read carefully and configure the preset file before running Read carefully and configure the preset file before running
Comment out function with the "#" char if you don't want it to be run 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 Uncomment function by removing the "#" char if you want it to be run
Every tweak in the preset file has its' corresponding function to restore the default settings 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 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 version Supported Windows 10 version
Version: 1809 Version: 1809
@ -64,13 +69,40 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script for LTSC v5.2 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & oz-zo, 2015–2021" $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, 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
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
@ -96,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
@ -113,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)
@ -214,7 +246,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
@ -247,15 +279,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
@ -266,28 +298,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
@ -323,7 +355,7 @@ TrayIcons -Show
ControlPanelView -LargeIcons ControlPanelView -LargeIcons
# 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
@ -334,14 +366,6 @@ WindowsColorScheme -Dark
# Установить режим цвета для Windows на светлый # Установить режим цвета для Windows на светлый
# WindowsColorScheme -Light # WindowsColorScheme -Light
# Set the default app mode color scheme to the dark
# Установить цвет режима приложений по умолчанию на темный
AppMode -Dark
# Set the default app mode color scheme to the light
# Установить цвет режима приложений по умолчанию на светлый
# AppMode -Light
# Do not show the "New App Installed" indicator # Do not show the "New App Installed" indicator
# Не показывать уведомление "Установлено новое приложение" # Не показывать уведомление "Установлено новое приложение"
NewAppInstalledNotification -Hide NewAppInstalledNotification -Hide

BIN
Sophia/LTSC/Sophia.psd1

Binary file not shown.

95
Sophia/LTSC/Sophia.psm1

@ -2,9 +2,11 @@
.SYNOPSIS .SYNOPSIS
"Windows 10 Sophia Script" (LTSC version) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks "Windows 10 Sophia Script" (LTSC version) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version: v5.2 Version: v5.2.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
@ -172,13 +174,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
@ -215,7 +217,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"
@ -223,7 +225,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
} }
} }
@ -1151,7 +1153,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
@ -1408,13 +1410,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
@ -1526,13 +1528,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
@ -1608,13 +1610,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
@ -1681,13 +1683,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
@ -2021,57 +2023,6 @@ function WindowsColorScheme
$Dark $Dark
) )
switch ($PSCmdlet.ParameterSetName)
{
"Light"
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -PropertyType DWord -Value 1 -Force
}
"Dark"
{
New-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name SystemUsesLightTheme -PropertyType DWord -Value 0 -Force
}
}
}
<#
.SYNOPSIS
Configure the default app mode color scheme
.PARAMETER Light
Set the default app mode color scheme to the light
.PARAMETER Dark
Set the default app mode color scheme to the dark
.EXAMPLE
AppMode -Light
.EXAMPLE
AppMode -Dark
.NOTES
Current user
#>
function AppMode
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Light"
)]
[switch]
$Light,
[Parameter(
Mandatory = $true,
ParameterSetName = "Dark"
)]
[switch]
$Dark
)
switch ($PSCmdlet.ParameterSetName) switch ($PSCmdlet.ParameterSetName)
{ {
"Light" "Light"

Loading…
Cancel
Save