Browse Source

v4.5.5 07.07.2020

# Windows 10 2004 | 1903/1909 Version

## Updated

- Closed #40 & #39
- Comments;
- Minor changes.

## Версия для Windows 10 2004 | 1903/1909

## Обновлено

- Закрыты #40 и #39
- Комментарии;
- Незначительные изменения.
pull/59/head 4.5.5
Dmitry Nefedov 4 years ago
committed by GitHub
parent
commit
f6be74d136
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 131
      Win 10 1903-1909.ps1
  2. 104
      Win 10 2004.ps1

131
Win 10 1903-1909.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
"Windows 10 Setup Script" is a set of tweaks for OS fine-tuning and automating the routine tasks
Version: v4.4.5
Date: 29.06.2020
Version: v4.4.6
Date: 07.07.2020
Copyright (c) 2020 farag & oZ-Zo
Thanks to all http://forum.ru-board.com members involved
@ -20,6 +20,10 @@
Running the script is best done on a fresh install because running it on tweaked system may result in errors occurring
Some third-party antiviruses flag this script or its' part as malicious one. This is a false positive due to $EncodedScript variable
You can read more on section "Create a Windows cleaning up task in the Task Scheduler"
You might need to disable tamper protection from your antivirus settings,re-enable it after running the script, and reboot
Check whether the .ps1 file is encoded in UTF-8 with BOM
The script can not be executed via PowerShell ISE
PowerShell must be run with elevated privileges
@ -2444,33 +2448,6 @@ New-ItemProperty -Path HKCU:\System\GameConfigStore -Name GameDVR_Enabled -Prope
# Отключить советы Xbox Game Bar
New-ItemProperty -Path HKCU:\Software\Microsoft\GameBar -Name ShowStartupPanel -PropertyType DWord -Value 0 -Force
<#
Uninstall all Xbox related UWP apps from all accounts
App packages will not be installed when new user accounts are created
Удалить все UWP-приложения, связанные с Xbox, из всех учетных записей
Приложения не будут установлены при создании новых учетных записей
#>
$XboxAppxPackages = @(
# Xbox Identity Provider
# Поставщик удостоверений Xbox
"Microsoft.XboxIdentityProvider"
# Xbox
# Компаньон консоли Xbox
"Microsoft.XboxApp"
# Xbox TCUI
"Microsoft.Xbox.TCUI"
# Xbox Speech To Text Overlay
"Microsoft.XboxSpeechToTextOverlay"
# Xbox Game Bar
"Microsoft.XboxGamingOverlay"
# Xbox Game Bar Plugin
"Microsoft.XboxGameOverlay"
)
$OFS = "|"
Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Where-Object -FilterScript {$_.Name -cmatch $XboxAppxPackages} | Remove-AppxPackage -AllUsers -Verbose
$OFS = " "
# Set "High performance" in graphics performance preference for apps
# Установить параметры производительности графики для отдельных приложений на "Высокая производительность"
if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScript {$_.AdapterDACType -ne "Internal" -and $null -ne $_.AdapterDACType})
@ -2488,8 +2465,10 @@ if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScrip
$Options = "&Add", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
@ -2533,6 +2512,8 @@ if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScrip
}
}
}
}
until ($Result -eq 1)
}
#endregion Gaming
@ -2802,10 +2783,12 @@ else
$Options = "&Add a protected folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2828,7 +2811,6 @@ switch ($Result)
Set-MpPreference -EnableControlledFolderAccess Enabled
Add-MpPreference -ControlledFolderAccessProtectedFolders $FolderBrowserDialog.SelectedPath -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2841,7 +2823,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Allow an app through Controlled folder access
# Разрешить работу приложения через контролируемый доступ к папкам
@ -2860,8 +2844,10 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
$Options = "&Add a protected folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
@ -2886,7 +2872,6 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
{
Add-MpPreference -ControlledFolderAccessAllowedApplications $OpenFileDialog.FileName -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2900,6 +2885,8 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
}
}
}
}
until ($Result -eq 1)
}
# Add exclusion folder from Windows Defender Antivirus scanning
@ -2917,10 +2904,12 @@ else
$Options = "&Exclude folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2942,7 +2931,6 @@ switch ($Result)
{
Add-MpPreference -ExclusionPath $FolderBrowserDialog.SelectedPath -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2955,7 +2943,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Add exclusion file from Windows Defender Antivirus scanning
# Добавить файл в список исключений сканирования Windows Defender
@ -2972,10 +2962,12 @@ else
$Options = "&Exclude file", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2998,7 +2990,6 @@ switch ($Result)
{
Add-MpPreference -ExclusionPath $OpenFileDialog.FileName -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -3011,7 +3002,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Turn on Windows Defender Exploit Guard network protection
# Включить защиту сети в Windows Defender
@ -3036,32 +3029,29 @@ New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Security Health\State"
# Turn on events auditing generated when a process is created or starts
# Включить аудит событий, возникающих при создании или запуске процесса
auditpol /set /subcategory:"{0CCE922B-69AE-11D9-BED3-505054503030}" /success:enable /failure:enable
$ProcessCreation = $true
# Include command line in process creation events
# Включать командную строку в событиях создания процесса
if ($RU)
{
$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
}
if ($ProcessCreation)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit -Name ProcessCreationIncludeCmdLine_Enabled -PropertyType DWord -Value 1 -Force
$ProcessCreationIncludeCmdLine_Enabled = $true
}
<#
Include command line in process creation events
In order this feature to work events auditing must be enabled
# Create "Process Creation" Event Viewer Custom View
# Создать настаиваемое представление "Создание процесса" в Просмотре событий
Включать командную строку в событиях создания процесса
Необходимо включить аудит событий, чтобы работала данная опция
#>
if ($RU)
{
$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit -Name ProcessCreationIncludeCmdLine_Enabled -PropertyType DWord -Value 1 -Force
if ($ProcessCreation -and $ProcessCreationIncludeCmdLine_Enabled)
{
$XML = @"
<ViewerConfig>
<#
Create "Process Creation" Event Viewer Custom View
In order this feature to work events auditing and command line in process creation events must be enabled
Создать настаиваемое представление "Создание процесса" в Просмотре событий
Необходимо включить аудит событий и командную строку в событиях создания процесса, чтобы работала данная опция
#>
$XML = @"
<ViewerConfig>
<QueryConfig>
<QueryParams>
<UserQuery />
@ -3076,24 +3066,23 @@ if ($ProcessCreation -and $ProcessCreationIncludeCmdLine_Enabled)
</QueryList>
</QueryNode>
</QueryConfig>
</ViewerConfig>
</ViewerConfig>
"@
if (-not (Test-Path -Path "$env:ProgramData\Microsoft\Event Viewer\Views"))
{
if (-not (Test-Path -Path "$env:ProgramData\Microsoft\Event Viewer\Views"))
{
New-Item -Path "$env:ProgramData\Microsoft\Event Viewer\Views" -ItemType Directory -Force
}
$ProcessCreationFilePath = "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml"
# Saving ProcessCreation.xml in UTF-8 encoding
# Сохраняем ProcessCreation.xml в кодировке UTF-8
Set-Content -Value (New-Object System.Text.UTF8Encoding).GetBytes($XML) -Encoding Byte -Path $ProcessCreationFilePath -Force
}
$ProcessCreationFilePath = "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml"
# Saving ProcessCreation.xml in UTF-8 encoding
# Сохраняем ProcessCreation.xml в кодировке UTF-8
Set-Content -Value (New-Object System.Text.UTF8Encoding).GetBytes($XML) -Encoding Byte -Path $ProcessCreationFilePath -Force
if ($RU)
{
if ($RU)
{
[xml]$XML = Get-Content -Path $ProcessCreationFilePath
$XML.ViewerConfig.QueryConfig.QueryNode.Name = "Создание процесса"
$XML.ViewerConfig.QueryConfig.QueryNode.Description = "События содания нового процесса и аудит командной строки"
$xml.Save("$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml")
}
}
# Turn on logging for all Windows PowerShell modules

104
Win 10 2004.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
"Windows 10 Setup Script" is a set of tweaks for OS fine-tuning and automating the routine tasks
Version: v4.5.4
Date: 29.06.2020
Version: v4.5.5
Date: 07.07.2020
Copyright (c) 2020 farag & oZ-Zo
Thanks to all http://forum.ru-board.com members involved
@ -20,6 +20,10 @@
Running the script is best done on a fresh install because running it on tweaked system may result in errors occurring
Some third-party antiviruses flag this script or its' part as malicious one. This is a false positive due to $EncodedScript variable
You can read more on section "Create a Windows cleaning up task in the Task Scheduler"
You might need to disable tamper protection from your antivirus settings,re-enable it after running the script, and reboot
Check whether the .ps1 file is encoded in UTF-8 with BOM
The script can not be executed via PowerShell ISE
PowerShell must be run with elevated privileges
@ -2458,8 +2462,10 @@ if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScrip
$Options = "&Add", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
@ -2503,6 +2509,8 @@ if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScrip
}
}
}
}
until ($Result -eq 1)
}
<#
@ -2795,10 +2803,12 @@ else
$Options = "&Add a protected folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2821,7 +2831,6 @@ switch ($Result)
Set-MpPreference -EnableControlledFolderAccess Enabled
Add-MpPreference -ControlledFolderAccessProtectedFolders $FolderBrowserDialog.SelectedPath -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2834,7 +2843,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Allow an app through Controlled folder access
# Разрешить работу приложения через контролируемый доступ к папкам
@ -2853,8 +2864,10 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
$Options = "&Add a protected folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
@ -2879,7 +2892,6 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
{
Add-MpPreference -ControlledFolderAccessAllowedApplications $OpenFileDialog.FileName -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2893,6 +2905,8 @@ if ((Get-MpPreference).EnableControlledFolderAccess -eq 1)
}
}
}
}
until ($Result -eq 1)
}
# Add exclusion folder from Microsoft Defender Antivirus scanning
@ -2910,10 +2924,12 @@ else
$Options = "&Exclude folder", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2935,7 +2951,6 @@ switch ($Result)
{
Add-MpPreference -ExclusionPath $FolderBrowserDialog.SelectedPath -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -2948,7 +2963,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Add exclusion file from Microsoft Defender Antivirus scanning
# Добавить файл в список исключений сканирования Microsoft Defender
@ -2965,10 +2982,12 @@ else
$Options = "&Exclude file", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
do
{
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
Add-Type -AssemblyName System.Windows.Forms
@ -2991,7 +3010,6 @@ switch ($Result)
{
Add-MpPreference -ExclusionPath $OpenFileDialog.FileName -Force
}
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
}
"1"
{
@ -3004,7 +3022,9 @@ switch ($Result)
Write-Verbose -Message "Skipped" -Verbose
}
}
}
}
until ($Result -eq 1)
# Turn on Microsoft Defender Exploit Guard network protection
# Включить защиту сети в Microsoft Defender Exploit Guard
@ -3029,32 +3049,29 @@ New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows Security Health\State"
# Turn on events auditing generated when a process is created or starts
# Включить аудит событий, возникающих при создании или запуске процесса
auditpol /set /subcategory:"{0CCE922B-69AE-11D9-BED3-505054503030}" /success:enable /failure:enable
$ProcessCreation = $true
# Include command line in process creation events
# Включать командную строку в событиях создания процесса
if ($RU)
{
$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
}
if ($ProcessCreation)
{
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit -Name ProcessCreationIncludeCmdLine_Enabled -PropertyType DWord -Value 1 -Force
$ProcessCreationIncludeCmdLine_Enabled = $true
}
<#
Include command line in process creation events
In order this feature to work events auditing must be enabled
# Create "Process Creation" Event Viewer Custom View
# Создать настаиваемое представление "Создание процесса" в Просмотре событий
Включать командную строку в событиях создания процесса
Необходимо включить аудит событий, чтобы работала данная опция
#>
if ($RU)
{
$OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit -Name ProcessCreationIncludeCmdLine_Enabled -PropertyType DWord -Value 1 -Force
if ($ProcessCreation -and $ProcessCreationIncludeCmdLine_Enabled)
{
$XML = @"
<ViewerConfig>
<#
Create "Process Creation" Event Viewer Custom View
In order this feature to work events auditing and command line in process creation events must be enabled
Создать настаиваемое представление "Создание процесса" в Просмотре событий
Необходимо включить аудит событий и командную строку в событиях создания процесса, чтобы работала данная опция
#>
$XML = @"
<ViewerConfig>
<QueryConfig>
<QueryParams>
<UserQuery />
@ -3069,24 +3086,23 @@ if ($ProcessCreation -and $ProcessCreationIncludeCmdLine_Enabled)
</QueryList>
</QueryNode>
</QueryConfig>
</ViewerConfig>
</ViewerConfig>
"@
if (-not (Test-Path -Path "$env:ProgramData\Microsoft\Event Viewer\Views"))
{
if (-not (Test-Path -Path "$env:ProgramData\Microsoft\Event Viewer\Views"))
{
New-Item -Path "$env:ProgramData\Microsoft\Event Viewer\Views" -ItemType Directory -Force
}
$ProcessCreationFilePath = "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml"
# Saving ProcessCreation.xml in UTF-8 encoding
# Сохраняем ProcessCreation.xml в кодировке UTF-8
Set-Content -Value (New-Object System.Text.UTF8Encoding).GetBytes($XML) -Encoding Byte -Path $ProcessCreationFilePath -Force
}
$ProcessCreationFilePath = "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml"
# Saving ProcessCreation.xml in UTF-8 encoding
# Сохраняем ProcessCreation.xml в кодировке UTF-8
Set-Content -Value (New-Object System.Text.UTF8Encoding).GetBytes($XML) -Encoding Byte -Path $ProcessCreationFilePath -Force
if ($RU)
{
if ($RU)
{
[xml]$XML = Get-Content -Path $ProcessCreationFilePath
$XML.ViewerConfig.QueryConfig.QueryNode.Name = "Создание процесса"
$XML.ViewerConfig.QueryConfig.QueryNode.Description = "События содания нового процесса и аудит командной строки"
$xml.Save("$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml")
}
}
# Turn on logging for all Windows PowerShell modules

Loading…
Cancel
Save