Browse Source

Add files via upload

pull/135/head
Dmitry Nefedov 4 years ago
committed by GitHub
parent
commit
ffb85e59fc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 53
      Sophia/LTSC/Sophia.ps1
  2. BIN
      Sophia/LTSC/Sophia.psd1
  3. 567
      Sophia/LTSC/Sophia.psm1
  4. 2
      Sophia/LTSC/cn-CN/Sophia.psd1
  5. 2
      Sophia/LTSC/de-DE/Sophia.psd1
  6. 2
      Sophia/LTSC/en-US/Sophia.psd1
  7. 2
      Sophia/LTSC/es-ES/Sophia.psd1
  8. 2
      Sophia/LTSC/fr-FR/Sophia.psd1
  9. 2
      Sophia/LTSC/it-IT/Sophia.psd1
  10. 2
      Sophia/LTSC/ru-RU/Sophia.psd1
  11. 2
      Sophia/LTSC/tr-TR/Sophia.psd1
  12. 2
      Sophia/LTSC/uk-UA/Sophia.psd1

53
Sophia/LTSC/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Windows 10 Sophia Script" (LTSC version)
Version: v5.0.2
Date: 20.01.2021
Version: v5.0.3
Date: 04.02.2021
Copyright (c) 2021 farag & oZ-Zo
Thanks to all https://forum.ru-board.com members involved
@ -27,7 +27,7 @@
.NOTES
https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15
https://habr.com/post/521202/
https://forums.mydigitallife.net/threads/powershell-script-setup-windows-10.81675/
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
@ -47,7 +47,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script for LTSC v5.0.2 | ©️ farag & oz-zo, 2015–2021"
$Host.UI.RawUI.WindowTitle = "Windows 10 Sophia Script for LTSC v5.0.3 | ©️ farag & oz-zo, 2015–2021"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Sophia.psd1 -PassThru -Force
@ -60,14 +60,23 @@ Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia
Добавляет возможность запускать скрипт, указывая в качестве параметров функции модуля
.EXAMPLE
.\Sophia.ps1 -Functions "FunctionName1 -Parameter", "FunctionName2 -Parameter"
.\Sophia.ps1 -Functions "FunctionName1 -Parameter", "FunctionName2 -Parameter", FunctionName3
.NOTES
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
Вне зависимости от введенных функций в качестве аргумента, сначала будет выполнена функция "Checkings", и в конце "Refresh" и "Errors"
#>
if ($Functions)
{
Invoke-Command -ScriptBlock {Checkings}
foreach ($Function in $Functions)
{
Invoke-Expression -Command $Function
}
Invoke-Command -ScriptBlock {Refresh; Errors}
exit
}
@ -508,30 +517,30 @@ WindowsManageDefaultPrinter -Disable
# WindowsManageDefaultPrinter -Enable
<#
Disable the Windows features using the pop-up dialog box that enables the user to select features to remove
Отключить компоненты Windows, используя всплывающее диалоговое окно, позволяющее пользователю отметить компоненты на удаление
Disable the Windows features using the pop-up dialog box
Отключить компоненты Windows, используя всплывающее диалоговое окно
If you want to leave "Multimedia settings" in the advanced settings of Power Options do not uninstall this feature
Если вы хотите оставить параметр "Параметры мультимедиа" в дополнительных параметрах электропитания, не удаляйте этот компонент
If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall the "MediaPlayback" feature
Если вы хотите оставить параметр "Параметры мультимедиа" в дополнительных параметрах электропитания, не удаляйте компонент "MediaPlayback"
#>
WindowsFeatures -Disable
# Enable the Windows features using the pop-up dialog box that enables the user to select features to remove
# Включить компоненты Windows, используя всплывающее диалоговое окно, позволяющее пользователю отметить компоненты на удаление
# Enable the Windows features using the pop-up dialog box
# Включить компоненты Windows, используя всплывающее диалоговое окно
# WindowsFeatures -Enable
<#
Disable Features On Demand v2 (FODv2) capabilities using the pop-up dialog box
Отключить компоненты "Функции по требованию" (FODv2), используя всплывающее диалоговое окно
Uninstall Features On Demand v2 (FODv2) capabilities using the pop-up dialog box
Удалить компоненты "Функции по требованию" (FODv2), используя всплывающее диалоговое окно
If you want to leave "Multimedia settings" in the advanced settings of Power Options do not uninstall this feature
Если вы хотите оставить параметр "Параметры мультимедиа" в дополнительных параметрах электропитания, не удаляйте этот компонент
If you want to leave "Multimedia settings" element in the advanced settings of Power Options do not uninstall the "MediaPlayback" feature
Если вы хотите оставить параметр "Параметры мультимедиа" в дополнительных параметрах электропитания, не удаляйте компонент "MediaPlayback"
#>
WindowsCapabilities -Disable
WindowsCapabilities -Uninstall
# Enable Feature On Demand v2 (FODv2) capabilities using the pop-up dialog box
# Включить компоненты "Функции по требованию" (FODv2), используя всплывающее диалоговое окно
# WindowsCapabilities -Enable
# Install Features On Demand v2 (FODv2) capabilities using the pop-up dialog box
# Установить компоненты "Функции по требованию" (FODv2), используя всплывающее диалоговое окно
# WindowsCapabilities -Install
# Opt-in to Microsoft Update service, so to receive updates for other Microsoft products
# Подключаться к службе Microsoft Update так, чтобы при обновлении Windows получать обновления для других продуктов Майкрософт
@ -915,14 +924,14 @@ SaveZoneInformation -Disable
<#
Disable Windows Script Host (current user only)
It becomes impossible to run .js and .vbs files
Blocks WSH from executing .js and .vbs files
Отключить Windows Script Host (только для текущего пользователя)
Становится невозможным запустить файлы .js и .vbs
Блокирует запуск файлов .js и .vbs
#>
# WindowsScriptHost -Disable
# Emable Windows Script Host (current user only) (default value)
# Enable Windows Script Host (current user only) (default value)
# Включить Windows Script Host (только для текущего пользователя) (значение по умолчанию)
# WindowsScriptHost -Enable

BIN
Sophia/LTSC/Sophia.psd1

Binary file not shown.

567
Sophia/LTSC/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
"Windows 10 Sophia Script" (LTSC version) is a PowerShell module for Windows 10 fine-tuning and automating the routine tasks
Version: v5.0.2
Date: 17.01.2020
Version: v5.0.3
Date: 04.02.2021
Copyright (c) 2021 farag & oZ-Zo
Thanks to all https://forum.ru-board.com members involved
@ -23,7 +23,7 @@
.NOTES
https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15
https://habr.com/post/521202/
https://forums.mydigitallife.net/threads/powershell-script-setup-windows-10.81675/
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
@ -61,6 +61,35 @@ function Checkings
}
}
# Checking whether the current module version is the latest
# Проверка: используется ли последняя версия модуля
try
{
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/farag2/Windows-10-Sophia-Script/master/LTSC/Sophia.psd1" -OutFile $DownloadsFolder\Manifest.psd1 -UseBasicParsing
$LatestRelease = (Import-PowerShellDataFile -Path $DownloadsFolder\Manifest.psd1).ModuleVersion
$CurrentRelease = (Get-Module -Name Sophia).Version.ToString()
Remove-Item -Path $DownloadsFolder\Manifest.psd1 -Force
switch ([System.Version]$LatestRelease -lt [System.Version]$CurrentRelease)
{
$true
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Windows-10-Sophia-Script/releases/latest"
exit
}
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
}
# Unblock all files in the folder by removing the Zone.Identifier alternate data stream with a value of "3"
# Разблокировать все файлы в папке, удалив альтернативный потоки данных Zone.Identifier со значением "3"
Get-ChildItem -Path $PSScriptRoot -Recurse -Force | Unblock-File -Confirm:$false
@ -79,6 +108,10 @@ function Checkings
# Открыть раздел "Защита от программ-шантажистов"
Start-Process -FilePath windowsdefender://RansomwareProtection
}
"0"
{
$Script:ControlledFolderAccess = $false
}
}
}
#endregion Checkings
@ -96,14 +129,23 @@ function Logging
Start-Transcript -Path $PSScriptRoot\$TrascriptFilename.txt -Force
}
# Create a restore point
# Создать точку восстановления
# Create a restore point for the system drive
# Создать точку восстановления для системного диска
function CreateRestorePoint
{
if (-not (Get-ComputerRestorePoint))
$SystemDriveUniqueID = (Get-Volume | Where-Object {$_.DriveLetter -eq "$($env:SystemDrive[0])"}).UniqueID
$SystemProtection = ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients")."{09F7EDC5-294E-4180-AF6A-FB0E6A0E9513}") | Where-Object -FilterScript {$_ -match [regex]::Escape($SystemDriveUniqueID)}
$ComputerRestorePoint = $false
switch ($null -eq $SystemProtection)
{
$true
{
$ComputerRestorePoint = $true
Enable-ComputerRestore -Drive $env:SystemDrive
}
}
# Never skip creating a restore point
# Никогда не пропускать создание точек восстановления
@ -114,6 +156,13 @@ function CreateRestorePoint
# Revert the System Restore checkpoint creation frequency to 1440 minutes
# Вернуть частоту создания точек восстановления на 1440 минут
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name SystemRestorePointCreationFrequency -PropertyType DWord -Value 1440 -Force
# Turn off System Protection for the system drive if it was turned off without deleting existing restore points
# Отключить защиту системы для диска C:\, если был отключен, не удаляя точки восстановления
if ($ComputerRestorePoint)
{
Disable-ComputerRestore -Drive $env:SystemDrive
}
}
#region Privacy & Telemetry
@ -402,17 +451,13 @@ function ScheduledTasks
Add-Type -AssemblyName PresentationCore, PresentationFramework
#region Variables
# Initialize an array list to store the scheduled tasks to remove
# Создать массив задач для удаления
$Tasks = New-Object -TypeName System.Collections.ArrayList($null)
# Initialize an array list to store the selected scheduled tasks
# Создать массив для выбранных задач
$SelectedTasks = New-Object -TypeName System.Collections.ArrayList($null)
# The following tasks will have their checkboxes checked
# Следующие задачи будут иметь чекбоксы отмеченными
$CheckedScheduledTasks = @(
# Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program
# Собирает телеметрические данные программы при участии в Программе улучшения качества программного обеспечения Майкрософт
"Microsoft Compatibility Appraiser",
[string[]]$CheckedScheduledTasks = @(
# Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program
# Сбор телеметрических данных программы при участии в программе улучшения качества ПО
"ProgramDataUpdater",
@ -433,14 +478,6 @@ function ScheduledTasks
# Для пользователей, участвующих в программе контроля качества программного обеспечения, служба диагностики дисков Windows предоставляет общие сведения о дисках и системе в корпорацию Майкрософт
"Microsoft-Windows-DiskDiagnosticDataCollector",
# Protects user files from accidental loss by copying them to a backup location when the system is unattended
# Защищает файлы пользователя от случайной потери за счет их копирования в резервное расположение, когда система находится в автоматическом режиме
"File History (maintenance mode)",
# Measures a system's performance and capabilities
# Измеряет быстродействие и возможности системы
"WinSAT",
# This task shows various Map related toasts
# Эта задача показывает различные тосты (всплывающие уведомления) приложения "Карты"
"MapsToastTask",
@ -517,7 +554,7 @@ function ScheduledTasks
$Reader = (New-Object -TypeName System.Xml.XmlNodeReader -ArgumentList $XAML)
$Form = [Windows.Markup.XamlReader]::Load($Reader)
$XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | ForEach-Object -Process {
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name) -Scope Global
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name)
}
#region Functions
@ -534,16 +571,18 @@ function ScheduledTasks
$CheckBox
)
$Task = $CheckBox.Parent.Children[1].Text
$Task = $Tasks | Where-Object -FilterScript {$_.TaskName -eq $CheckBox.Parent.Children[1].Text}
if ($CheckBox.IsChecked)
{
[void]$Tasks.Add($Task)
[void]$SelectedTasks.Add($Task)
}
else
{
[void]$Tasks.Remove($Task)
[void]$SelectedTasks.Remove($Task)
}
if ($Tasks.Count -gt 0)
if ($SelectedTasks.Count -gt 0)
{
$Button.IsEnabled = $true
}
@ -555,18 +594,22 @@ function ScheduledTasks
function DisableButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
$OFS = "|"
Get-ScheduledTask | Where-Object -FilterScript {$_.TaskName -cmatch $Tasks} | Disable-ScheduledTask
$OFS = " "
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
function EnableButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
$OFS = "|"
Get-ScheduledTask | Where-Object -FilterScript {$_.TaskName -cmatch $Tasks} | Enable-ScheduledTask
$OFS = " "
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
function Add-TaskControl
@ -579,30 +622,32 @@ function ScheduledTasks
ValueFromPipeline = $true
)]
[ValidateNotNull()]
[string]
$Task
)
process
{
$CheckBox = New-Object -TypeName System.Windows.Controls.CheckBox
$CheckBox.Add_Click({Get-CheckboxClicked -CheckBox $_.Source})
$TextBlock = New-Object -TypeName System.Windows.Controls.TextBlock
$TextBlock.Text = $Task
$TextBlock.Text = $Task.TaskName
$StackPanel = New-Object -TypeName System.Windows.Controls.StackPanel
[void]$StackPanel.Children.Add($CheckBox)
[void]$StackPanel.Children.Add($TextBlock)
[void]$PanelContainer.Children.Add($StackPanel)
$CheckBox.IsChecked = $false
# If task checked, add to the array list to remove
# Если задача выделена, то добавить в массив для удаления
if ($CheckedScheduledTasks | Where-Object -FilterScript {$Task -like $_})
# If task checked add to the array list
# Если задача выделена, то добавить в массив
if ($CheckedScheduledTasks | Where-Object -FilterScript {$Task.TaskName -match $_})
{
$CheckBox.IsChecked = $true
[void]$Tasks.Add($Task)
[void]$SelectedTasks.Add($Task)
}
else
{
$CheckBox.IsChecked = $false
}
}
}
#endregion Functions
@ -611,64 +656,37 @@ function ScheduledTasks
{
"Enable"
{
#region Events Handlers
$OptionalTasks = New-Object -TypeName System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
$OFS = "|"
$OptionalTasks = @(Get-ScheduledTask | Where-Object -FilterScript {($_.State -eq "Disabled") -and ($_.TaskName -in $CheckedScheduledTasks)})
if ($OptionalTasks.Count -gt 0)
{
$OptionalTasks | ForEach-Object -Process {
Add-TaskControl -Task $_.TaskName
}
$Button.Content = $Localization.Enable
}
else
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
}
$OFS = " "
})
# Button Click Event
$Button.Add_Click({EnableButton})
#endregion Events Handlers
$State = "Disabled"
$ButtonContent = $Localization.Enable
$ButtonAdd_Click = {EnableButton}
}
"Disable"
{
#region Events Handlers
$OptionalTasks = New-Object System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
$OFS = "|"
$OptionalTasks = @(Get-ScheduledTask | Where-Object -FilterScript {($_.State -eq "Ready") -and ($_.TaskName -in $CheckedScheduledTasks)})
if ($OptionalTasks.Count -gt 0)
{
$OptionalTasks | ForEach-Object -Process {
Add-TaskControl -Task $_.TaskName
$State = "Ready"
$ButtonContent = $Localization.Disable
$ButtonAdd_Click = {DisableButton}
}
$Button.Content = $Localization.Disable
}
else
Write-Verbose -Message $Localization.Patient -Verbose
# Получаем общий список задач, согласно условиям
# Getting a list of tasks according to the conditions
$Tasks = Get-ScheduledTask | Where-Object -FilterScript {($_.State -eq $State) -and ($_.TaskName -in $CheckedScheduledTasks)}
if (-not ($Tasks))
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
}
$OFS = " "
})
# Button Click Event
$Button.Add_Click({DisableButton})
#endregion Events Handlers
}
return
}
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
$Window.Add_Loaded({$Tasks | Add-TaskControl})
$Button.Content = $ButtonContent
$Button.Add_Click({& $ButtonAdd_Click})
$Window.Title = $Localization.ScheduledTasks
$Form.ShowDialog() | Out-Null
}
@ -2389,16 +2407,21 @@ function TaskManagerWindow
)
$Taskmgr = Get-Process -Name Taskmgr -ErrorAction Ignore
Start-Sleep -Seconds 1
if ($Taskmgr)
{
$Taskmgr.CloseMainWindow()
}
Start-Process -FilePath Taskmgr.exe -WindowStyle Hidden -PassThru
Start-Process -FilePath Taskmgr.exe -PassThru
Start-Sleep -Seconds 3
do
{
Start-Sleep -Milliseconds 100
$Preferences = Get-ItemPropertyValue -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskManager -Name Preferences -ErrorAction Ignore
$Preferences = Get-ItemPropertyValue -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\TaskManager -Name Preferences
}
until ($Preferences)
@ -3516,11 +3539,13 @@ function WindowsManageDefaultPrinter
WindowsFeatures -Enable
.NOTES
A pop-up dialog box enables the user to select features to remove
A pop-up dialog box enables the user to select features
Current user only
Используется всплывающее диалоговое окно, позволяющее пользователю отметить компоненты на удаление
Используется всплывающее диалоговое окно, позволяющее пользователю отмечать компоненты
Только для текущего пользователя
Made by https://github.com/oz-zo, iNNOKENTIY21
#>
function WindowsFeatures
{
@ -3544,13 +3569,13 @@ function WindowsFeatures
Add-Type -AssemblyName PresentationCore, PresentationFramework
#region Variables
# Initialize an array list to store the Windows Features items to remove
# Создать массив имен компонентов Windows для удаления
$Features = New-Object -TypeName System.Collections.ArrayList($null)
# Initialize an array list to store the selected Windows features
# Создать массив для выбранных компонентов Windows
$SelectedFeatures = New-Object -TypeName System.Collections.ArrayList($null)
# The following Windows Features are recommended the user to remove
# Следующие компоненты Windows рекомендуются к удалению
$WindowsFeatures = @(
# The following FODv2 items will have their checkboxes checked
# Следующие дополнительные компоненты будут иметь чекбоксы отмеченными
[string[]]$CheckedFeatures = @(
# Legacy Components
# Компоненты прежних версий
"LegacyComponents",
@ -3625,7 +3650,7 @@ function WindowsFeatures
$Reader = (New-Object -TypeName System.Xml.XmlNodeReader -ArgumentList $XAML)
$Form = [Windows.Markup.XamlReader]::Load($Reader)
$XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | ForEach-Object -Process {
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name) -Scope Global
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name)
}
#region Functions
@ -3642,16 +3667,17 @@ function WindowsFeatures
$CheckBox
)
$Feature = $CheckBox.Parent.Children[1].Text
$Feature = $Features | Where-Object -FilterScript {$_.DisplayName -eq $CheckBox.Parent.Children[1].Text}
if ($CheckBox.IsChecked)
{
[void]$Features.Add($Feature)
[void]$SelectedFeatures.Add($Feature)
}
else
{
[void]$Features.Remove($Feature)
[void]$SelectedFeatures.Remove($Feature)
}
if ($Features.Count -gt 0)
if ($SelectedFeatures.Count -gt 0)
{
$Button.IsEnabled = $true
}
@ -3663,14 +3689,22 @@ function WindowsFeatures
function DisableButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
Disable-WindowsOptionalFeature -Online -FeatureName $Features -NoRestart
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
function EnableButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
Enable-WindowsOptionalFeature -Online -FeatureName $Features -NoRestart
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Enable-WindowsOptionalFeature -Online -NoRestart
}
function Add-FeatureControl
@ -3683,30 +3717,32 @@ function WindowsFeatures
ValueFromPipeline = $true
)]
[ValidateNotNull()]
[string]
$Feature
)
process
{
$CheckBox = New-Object -TypeName System.Windows.Controls.CheckBox
$CheckBox.Add_Click({Get-CheckboxClicked -CheckBox $_.Source})
$CheckBox.ToolTip = $Feature.Description
$TextBlock = New-Object -TypeName System.Windows.Controls.TextBlock
$TextBlock.Text = $Feature
$TextBlock.Text = $Feature.DisplayName
$TextBlock.ToolTip = $Feature.Description
$StackPanel = New-Object -TypeName System.Windows.Controls.StackPanel
[void]$StackPanel.Children.Add($CheckBox)
[void]$StackPanel.Children.Add($TextBlock)
[void]$PanelContainer.Children.Add($StackPanel)
$CheckBox.IsChecked = $false
$CheckBox.IsChecked = $true
# If feature checked, add to the array list to remove
# Если компонент выделен, то добавить в массив для удаления
if ($WindowsFeatures | Where-Object -FilterScript {$Feature -like $_})
# If feature checked add to the array list
# Если компонент выделен, то добавить в массив
if ($CheckBox.IsChecked)
{
$CheckBox.IsChecked = $true
[void]$Features.Add($Feature)
[void]$SelectedFeatures.Add($Feature)
}
}
}
#endregion Functions
@ -3715,86 +3751,63 @@ function WindowsFeatures
{
"Enable"
{
#region Events Handlers
$OptionalFeatures = New-Object -TypeName System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
$OFS = "|"
$OptionalFeatures = Get-WindowsOptionalFeature -Online | Where-Object -FilterScript {($_.State -eq "Disabled" -or $_.State -eq "DisablePending") -and ($_.FeatureName -in $WindowsFeatures)}
if ($OptionalFeatures.Count -gt 0)
{
$OptionalFeatures | ForEach-Object -Process {
Add-FeatureControl -Feature $_.FeatureName
}
$Button.Content = $Localization.Enable
$State = @("Disabled", "DisablePending")
$ButtonContent = $Localization.Enable
$ButtonAdd_Click = {EnableButton}
}
else
"Disable"
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
$State = @("Enabled", "EnablePending")
$ButtonContent = $Localization.Disable
$ButtonAdd_Click = {DisableButton}
}
$OFS = " "
})
# Button Click Event
$Button.Add_Click({EnableButton})
#endregion Events Handlers
}
"Disable"
{
#region Events Handlers
$OptionalFeatures = New-Object -TypeName System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
Write-Verbose -Message $Localization.Patient -Verbose
# Получаем общий список дополнительных компонентов, согласно условиям
# Getting a list of features according to the conditions
$OFS = "|"
$OptionalFeatures = Get-WindowsOptionalFeature -Online | Where-Object -FilterScript {($_.State -eq "Enabled" -or $_.State -eq "EnablePending") -and ($_.FeatureName -in $WindowsFeatures)}
if ($OptionalFeatures.Count -gt 0)
{
$OptionalFeatures | ForEach-Object -Process {
Add-FeatureControl -Feature $_.FeatureName
}
$Features = Get-WindowsOptionalFeature -Online | Where-Object -FilterScript {
($_.State -in $State) -and ($_.FeatureName -cmatch $CheckedFeatures)
} | ForEach-Object -Process {Get-WindowsOptionalFeature -FeatureName $_.FeatureName -Online}
$OFS = " "
$Button.Content = $Localization.Disable
}
else
if (-not ($Features))
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
}
$OFS = " "
})
# Button Click Event
$Button.Add_Click({DisableButton})
#endregion Events Handlers
}
return
}
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
$Window.Add_Loaded({$Features | Add-FeatureControl})
$Button.Content = $ButtonContent
$Button.Add_Click({& $ButtonAdd_Click})
$Window.Title = $Localization.WindowsFeaturesWindowTitle
$Form.ShowDialog() | Out-Null
}
<#
.SYNOPSIS
Disable/enable Features On Demand v2 (FODv2) capabilities
Отключить/включить компоненты "Функции по требованию" (FODv2)
Uninstall/install Features On Demand v2 (FODv2) capabilities
Удалить/установить компоненты "Функции по требованию" (FODv2)
.PARAMETER Disable
Disable Features On Demand v2 (FODv2) capabilities
Отключить компоненты "Функции по требованию" (FODv2)
.PARAMETER Uninstall
Uninstall Features On Demand v2 (FODv2) capabilities
Удалить компоненты "Функции по требованию" (FODv2)
.PARAMETER Enable
Enable Features On Demand v2 (FODv2) capabilities
Включить компоненты "Функции по требованию" (FODv2)
.PARAMETER Install
Install Features On Demand v2 (FODv2) capabilities
Установить компоненты "Функции по требованию" (FODv2)
.EXAMPLE
WindowsCapabilities -Disable
WindowsCapabilities -Uninstall
.EXAMPLE
WindowsCapabilities -Enable
WindowsCapabilities -Install
.NOTES
A pop-up dialog box enables the user to select features
@ -3803,7 +3816,7 @@ function WindowsFeatures
Используется всплывающее диалоговое окно, позволяющее пользователю отмечать компоненты
Только для текущего пользователя
Made by https://github.com/oz-zo
Made by https://github.com/oz-zo, iNNOKENTIY21
#>
function WindowsCapabilities
{
@ -3811,29 +3824,29 @@ function WindowsCapabilities
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
ParameterSetName = "Install"
)]
[switch]
$Enable,
$Install,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
ParameterSetName = "Uninstall"
)]
[switch]
$Disable
$Uninstall
)
Add-Type -AssemblyName PresentationCore, PresentationFramework
#region Variables
# Initialize an array list to store the FODv2 items to disable
# Создать массив имен дополнительных компонентов для отключения
$Capabilities = New-Object -TypeName System.Collections.ArrayList($null)
# Initialize an array list to store the selected FODv2 items
# Создать массив дополнительных компонентов для выбранных элементов
$SelectedCapabilities = New-Object -TypeName System.Collections.ArrayList($null)
# The following FODv2 items will have their checkboxes checked
# Следующие дополнительные компоненты будут иметь чекбоксы отмеченными
$CheckedCapabilities = @(
[string[]]$CheckedCapabilities = @(
# Microsoft Quick Assist
# Быстрая поддержка (Майкрософт)
"App.Support.QuickAssist*"
@ -3841,7 +3854,7 @@ function WindowsCapabilities
# The following FODv2 items will have their checkboxes unchecked
# Следующие дополнительные компоненты будут иметь чекбоксы неотмеченными
$UncheckedCapabilities = @(
[string[]]$UncheckedCapabilities = @(
# Internet Explorer 11
"Browser.InternetExplorer*",
@ -3858,18 +3871,26 @@ function WindowsCapabilities
#>
"Media.WindowsMediaPlayer*",
# Language components
# Языковые компоненты
# OpenSSH Client
# Клиент OpenSSH
"OpenSSH.Client*"
)
# The following FODv2 items will be excluded from the display
# Следующие дополнительные компоненты будут исключены из отображения
$ExcludedCapabilities = @(
[string[]]$ExcludedCapabilities = @(
# The DirectX Database to configure and optimize apps when multiple Graphics Adapters are present
# База данных DirectX для настройки и оптимизации приложений при наличии нескольких графических адаптеров
"DirectX.Configuration.Database*",
# Language components
# Языковые компоненты
"Language.*",
# Notepad
# Блокнот
"Microsoft.Windows.Notepad*",
# Mail, contacts, and calendar sync component
# Компонент синхронизации почты, контактов и календаря
"OneCoreUAP.OneSync*"
@ -3923,10 +3944,24 @@ function WindowsCapabilities
$Reader = (New-Object -TypeName System.Xml.XmlNodeReader -ArgumentList $XAML)
$Form = [Windows.Markup.XamlReader]::Load($Reader)
$XAML.SelectNodes("//*[@*[contains(translate(name(.),'n','N'),'Name')]]") | ForEach-Object -Process {
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name) -Scope Global
Set-Variable -Name ($_.Name) -Value $Form.FindName($_.Name)
}
#region Functions
function InternetConnectionStatus
{
try
{
(Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
return
}
}
function Get-CheckboxClicked
{
[CmdletBinding()]
@ -3940,16 +3975,18 @@ function WindowsCapabilities
$CheckBox
)
$Capability = $CheckBox.Parent.Children[1].Text
$Capability = $Capabilities | Where-Object -FilterScript {$_.DisplayName -eq $CheckBox.Parent.Children[1].Text}
if ($CheckBox.IsChecked)
{
[void]$Capabilities.Add($Capability)
[void]$SelectedCapabilities.Add($Capability)
}
else
{
[void]$Capabilities.Remove($Capability)
[void]$SelectedCapabilities.Remove($Capability)
}
if ($Capabilities.Count -gt 0)
if ($SelectedCapabilities.Count -gt 0)
{
$Button.IsEnabled = $true
}
@ -3959,27 +3996,31 @@ function WindowsCapabilities
}
}
function DisableButton
function UninstallButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
$OFS = "|"
Get-WindowsCapability -Online | Where-Object -FilterScript {$_.Name -cmatch $Capabilities} | Remove-WindowsCapability -Online
$OFS = " "
if ([string]$Capabilities -cmatch "Browser.InternetExplorer*")
$SelectedCapabilities | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedCapabilities | Where-Object -FilterScript {$_.Name -in (Get-WindowsCapability -Online).Name} | Remove-WindowsCapability -Online
if ([string]$SelectedCapabilities.Name -cmatch "Browser.InternetExplorer*")
{
Write-Warning -Message $Localization.RestartWarning
}
}
function EnableButton
function InstallButton
{
Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close()
$OFS = "|"
Get-WindowsCapability -Online | Where-Object -FilterScript {$_.Name -cmatch $Capabilities} | Add-WindowsCapability -Online
$OFS = " "
if ([string]$Capabilities -cmatch "Browser.InternetExplorer*")
$SelectedCapabilities | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedCapabilities | Where-Object -FilterScript {$_.Name -in ((Get-WindowsCapability -Online).Name)} | Add-WindowsCapability -Online
if ([string]$SelectedCapabilities.Name -cmatch "Browser.InternetExplorer*")
{
Write-Warning -Message $Localization.RestartWarning
}
@ -3995,111 +4036,81 @@ function WindowsCapabilities
ValueFromPipeline = $true
)]
[ValidateNotNull()]
[string]
$Capability
)
process
{
$CheckBox = New-Object -TypeName System.Windows.Controls.CheckBox
$CheckBox.Add_Click({Get-CheckboxClicked -CheckBox $_.Source})
$CheckBox.ToolTip = $Capability.Description
$TextBlock = New-Object -TypeName System.Windows.Controls.TextBlock
$TextBlock.Text = $Capability
$TextBlock.Text = $Capability.DisplayName
$TextBlock.ToolTip = $Capability.Description
$StackPanel = New-Object -TypeName System.Windows.Controls.StackPanel
[void]$StackPanel.Children.Add($CheckBox)
[void]$StackPanel.Children.Add($TextBlock)
[void]$PanelContainer.Children.Add($StackPanel)
# If capability checked, add to the array list to remove
# Если компонент выделен, то добавить в массив для удаления
if ($UnCheckedCapabilities | Where-Object -FilterScript {$Capability -like $_})
# If capability checked add to the array list
# Если компонент выделен, то добавить в массив
if ($UnCheckedCapabilities | Where-Object -FilterScript {$Capability.Name -like $_})
{
$CheckBox.IsChecked = $false
# Exit function, item is not checked
# Exit function if item is not checked
# Выход из функции, если элемент не выделен
return
}
# If capability checked, add to the array list to remove
# Если компонент выделен, то добавить в массив для удаления
[void]$Capabilities.Add($Capability)
# If capability checked add to the array list
# Если компонент выделен, то добавить в массив
[void]$SelectedCapabilities.Add($Capability)
}
}
#endregion Functions
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
"Install"
{
try
{
(Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription
InternetConnectionStatus
$State = "NotPresent"
$ButtonContent = $Localization.Install
$ButtonAdd_Click = {InstallButton}
}
catch [System.Net.WebException]
"Uninstall"
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
return
$State = "Installed"
$ButtonContent = $Localization.Uninstall
$ButtonAdd_Click = {UninstallButton}
}
#region Events Handlers
$OptionalCapabilities = New-Object -TypeName System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
$OFS = "|"
$OptionalCapabilities = Get-WindowsCapability -Online | Where-Object -FilterScript {($_.State -eq "NotPresent") -and ($_.Name -cmatch $CheckedCapabilities) -($_.Name -cmatch $UncheckedCapabilities) -and ($_.Name -cnotmatch $ExcludedCapabilities)}
if ($OptionalCapabilities.Count -gt 0)
{
$OptionalCapabilities | ForEach-Object -Process {
Add-CapabilityControl -Capability $_.Name
}
$Button.Content = $Localization.Enable
}
else
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
}
$OFS = " "
})
Write-Verbose -Message $Localization.Patient -Verbose
# Button Click Event
$Button.Add_Click({EnableButton})
#endregion Events Handlers
}
"Disable"
{
#region Events Handlers
$OptionalCapabilities = New-Object -TypeName System.Collections.ArrayList($null)
# Window Loaded Event
$Window.Add_Loaded({
# Получаем общий список дополнительных компонентов, согласно условиям
# Getting a list of capabilities according to the conditions
$OFS = "|"
$OptionalCapabilities = Get-WindowsCapability -Online | Where-Object -FilterScript {($_.State -eq "Installed") -and ($_.Name -cnotmatch $ExcludedCapabilities)}
if ($OptionalCapabilities.Count -gt 0)
{
$OptionalCapabilities | ForEach-Object -Process {
Add-CapabilityControl -Capability $_.Name
}
$Capabilities = Get-WindowsCapability -Online | Where-Object -FilterScript {
($_.State -eq $State) -and (($_.Name -cmatch $UncheckedCapabilities) -or ($_.Name -cmatch $CheckedCapabilities) -and ($_.Name -cnotmatch $ExcludedCapabilities))
} | ForEach-Object -Process {Get-WindowsCapability -Name $_.Name -Online}
$OFS = " "
$Button.Content = $Localization.Disable
}
else
if (-not ($Capabilities))
{
Write-Verbose -Message $Localization.NoData -Verbose
$Form.Close()
}
$OFS = " "
})
# Button Click Event
$Button.Add_Click({DisableButton})
#endregion Events Handlers
}
return
}
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
$Window.Add_Loaded({$Capabilities | Add-CapabilityControl})
$Button.Content = $ButtonContent
$Button.Add_Click({& $ButtonAdd_Click})
$Window.Title = $Localization.FODWindowTitle
$Form.ShowDialog() | Out-Null
}
@ -7344,10 +7355,10 @@ function SaveZoneInformation
.NOTES
Current user only
It becomes impossible to run .js and .vbs files
Blocks WSH from executing .js and .vbs files
Только для текущего пользователя
Становится невозможным запустить файлы .js и .vbs
Блокирует запуск файлов .js и .vbs
#>
function WindowsScriptHost
{
@ -8103,10 +8114,22 @@ function BitmapImageNewContext
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.bmp\ShellNew -Name NullFile -PropertyType String -Value "" -Force
}
else
{
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
{
Get-WindowsCapability -Online -Name "Microsoft.Windows.MSPaint*" | Add-WindowsCapability -Online
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
return
}
}
}
}
}
@ -8169,10 +8192,22 @@ function RichTextDocumentNewContext
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.rtf\ShellNew -Name ItemName -PropertyType ExpandString -Value "@%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE,-213" -Force
}
else
{
try
{
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
{
Get-WindowsCapability -Online -Name "Microsoft.Windows.WordPad*" | Add-WindowsCapability -Online
}
}
catch [System.Net.WebException]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
return
}
}
}
}
}

2
Sophia/LTSC/cn-CN/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = 该脚本仅支持Windows 10 x64
UnsupportedOSBuild = 该脚本支持Windows 10版本1809 Enterprise LTSC
UnsupportedRelease = 找到新版本
ControlledFolderAccessDisabled = 受控文件夹访问禁用
ScheduledTasks = 计划任务
ClearFolder = 删除"{0}"文件夹中的所有文件?
@ -75,4 +76,5 @@ Skip = 跳过
Skipped = 已跳过
SymbolicSkipped = 跳过创建符号链接
Uninstall = 卸载
Install = 安装
'@

2
Sophia/LTSC/de-DE/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Das Skript unterstützt nur Windows 10 x64
UnsupportedOSBuild = Das Skript unterstützt Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Neue Version gefunden
ControlledFolderAccessDisabled = Kontrollierter Ordnerzugriff deaktiviert
ScheduledTasks = Geplante Aufgaben
ClearFolder = Löscht alle Dateien im Ordner "{0}"?
@ -75,4 +76,5 @@ Skip = Überspringen
Skipped = Übersprungen
SymbolicSkipped = Das Erstellen eines symbolischen Links wurde übersprungen
Uninstall = Deinstallieren
Install = Installieren
'@

2
Sophia/LTSC/en-US/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = The script supports Windows 10 x64 only
UnsupportedOSBuild = The script supports Windows 10 1809 Enterprise LTSC
UnsupportedRelease = New version found
ControlledFolderAccessDisabled = Controlled folder access disabled
ScheduledTasks = Scheduled tasks
ClearFolder = Delete all files in the "{0}" folder?
@ -75,4 +76,5 @@ Skip = Skip
Skipped = Skipped
SymbolicSkipped = Skipped creating a symbolic link
Uninstall = Uninstall
Install = Install
'@

2
Sophia/LTSC/es-ES/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Este script solo soporta Windows 10 x64
UnsupportedOSBuild = Este script solo soporta Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Nueva versión encontrada
ControlledFolderAccessDisabled = Acceso a carpetas controlado desactivado
ScheduledTasks = Tareas programadas
ClearFolder = Elimine todos los archivos en la carpeta "{0}"?
@ -75,4 +76,5 @@ Skip = Omitir
Skipped = Omitido
SymbolicSkipped = Se omitió la creación de un enlace simbólico
Uninstall = Desinstalar
Install = Instalar
'@

2
Sophia/LTSC/fr-FR/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Le script supporte uniquement Windows 10 x64
UnsupportedOSBuild = Le script supporte les versions Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Nouvelle version trouvée
ControlledFolderAccessDisabled = Contrôle d'accès aux dossiers désactivé
ScheduledTasks = Tâches planifiées
ClearFolder = Supprimer tous les fichiers dans le dossier "{0}"?
@ -75,4 +76,5 @@ Skip = Passer
Skipped = Passé
SymbolicSkipped = La création d'un lien symbolique a été ignorée
Uninstall = Désinstaller
Install = Installer
'@

2
Sophia/LTSC/it-IT/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Questo script supporta solo Windows 10 x64
UnsupportedOSBuild = Lo script supporta le versioni di Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Nuova versione trovata
ControlledFolderAccessDisabled = Accesso controllato alle cartelle disabilitato
ScheduledTasks = Attività pianificate
ClearFolder = Elimina tutti i file nella cartella "{0}"?
@ -75,4 +76,5 @@ Skip = Salta
Skipped = Saltato
SymbolicSkipped = È stata saltata la creazione di un collegamento simbolico
Uninstall = Rimuovi
Install = Installare
'@

2
Sophia/LTSC/ru-RU/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт поддерживает только Windows 10 x64
UnsupportedOSBuild = Скрипт поддерживает только Windows 10 версии 1809 Enterprise LTSC
UnsupportedRelease = Обнаружена новая версия
ControlledFolderAccessDisabled = Контролируемый доступ к папкам выключен
ScheduledTasks = Запланированные задачи
ClearFolder = Удалить все файлы в папке "{0}"?
@ -75,4 +76,5 @@ Skip = Пропустить
Skipped = Пропущено
SymbolicSkipped = Пропущено создание символической ссылки
Uninstall = Удалить
Install = Установить
'@

2
Sophia/LTSC/tr-TR/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Bu betik sadece Windows 10 x64 destekliyor
UnsupportedOSBuild = Bu betik sadece Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Yeni sürüm bulundu
ControlledFolderAccessDisabled = Kontrollü klasör erişimi devre dışı bırakıldı
ScheduledTasks = Zamanlanan görevler
ClearFolder = "{0}" klasöründeki tüm dosyaları silin?
@ -75,4 +76,5 @@ Skip = Atla
Skipped = Atlandı
SymbolicSkipped = Sembolik bir bağlantı oluşturma atlandı
Uninstall = Kaldır
Install = Yüklemek
'@

2
Sophia/LTSC/uk-UA/Sophia.psd1

@ -1,6 +1,7 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт підтримує тільки Windows 10 x64
UnsupportedOSBuild = Скрипт підтримує тільки Windows 10 1809 Enterprise LTSC
UnsupportedRelease = Виявлено нову версію
ControlledFolderAccessDisabled = Контрольований доступ до папок вимкнений
ScheduledTasks = Заплановані задачі
ClearFolder = Видаліть всі файли у папці "{0}"?
@ -75,4 +76,5 @@ Skip = Пропустити
Skipped = Пропущено
SymbolicSkipped = Пропущено створення символічного посилання
Uninstall = Видалити
Install = Встановити
'@

Loading…
Cancel
Save