diff --git a/LTSC.ps1 b/LTSC.ps1 new file mode 100644 index 00000000..0690632a --- /dev/null +++ b/LTSC.ps1 @@ -0,0 +1,2483 @@ +<# +.SYNOPSIS + "Windows 10 Setup Script" is a set of tweaks for OS fine-tuning and automating the routine tasks +.DESCRIPTION + Supported Windows 10 version: 1809 Enterprise LTSC, 17763 build, x64 + + 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 + + Set execution policy to be able to run scripts only in the current PowerShell session: + Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force + + Running the script is best done on a fresh install +.EXAMPLE + PS C:\> & '.\LTSC.ps1' +.NOTES + Version: v4.5 + Date: 10.06.2020 + Written by: farag & oZ-Zo + Thanks to all http://forum.ru-board.com members involved + + Ask a question on + http://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 + https://habr.com/en/post/465365/ + https://4pda.ru/forum/index.php?showtopic=523489&st=42860#entry95909388 + https://forums.mydigitallife.net/threads/powershell-script-setup-windows-10.81675/ + https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ + + Copyright (c) 2020 farag & oZ-Zo +.LINK + https://github.com/farag2/Windows-10-Setup-Script +#> + +#Requires -RunAsAdministrator +#Requires -Version 5.1 + +#region Check +Clear-Host + +# Get information about the current culture settings +# Получить сведения о параметрах текущей культуры +if ($PSUICulture -eq "ru-RU") +{ + $RU = $true +} +else +{ + $RU = $false +} + +# Detect the OS bitness +# Определить разрядность ОС +switch ([Environment]::Is64BitOperatingSystem) +{ + $false + { + if ($RU) + { + Write-Warning -Message "Скрипт поддерживает только Windows 10 x64" + } + else + { + Write-Warning -Message "The script supports Windows 10 x64 only" + } + break + } + Default {} +} + +# Detect the PowerShell bitness +# Определить разрядность PowerShell +switch ([IntPtr]::Size -eq 8) +{ + $false + { + if ($RU) + { + Write-Warning -Message "Скрипт поддерживает только PowerShell x64" + } + else + { + Write-Warning -Message "The script supports PowerShell x64 only" + } + break + } + Default {} +} + +# Detect whether the script is running via PowerShell ISE +# Определить, запущен ли скрипт в PowerShell ISE +if ($psISE) +{ + if ($RU) + { + Write-Warning -Message "Скрипт не может быть запущен в PowerShell ISE" + } + else + { + Write-Warning -Message "The script can not be run via PowerShell ISE" + } + break +} +#endregion Check + +#region Begin +Set-StrictMode -Version Latest + +# Сlear $Error variable +# Очистка переменной $Error +$Error.Clear() + +# Set the encoding to UTF-8 without BOM for the PowerShell session +# Установить кодировку UTF-8 без BOM для текущей сессии PowerShell +if ($RU) +{ + ping.exe | Out-Null + $OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 +} + +# Create a restore point +# Создать точку восстановления +if ($RU) +{ + $Title = "Точка восстановления" + $Message = "Чтобы создайте точку восстановления, введите необходимую букву" + $Options = "&Создать", "&Не создавать", "&Пропустить" +} +else +{ + $Title = "Restore point" + $Message = "To create a restore point enter the required letter" + $Options = "&Create", "&Do not create", "&Skip" +} +$DefaultChoice = 2 +$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice) + +switch ($Result) +{ + "0" + { + if (-not (Get-ComputerRestorePoint)) + { + Enable-ComputerRestore -Drive $env:SystemDrive + } + # Set system restore point creation frequency to 5 minutes + # Установить частоту создания точек восстановления на 5 минут + New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" -Name SystemRestorePointCreationFrequency -PropertyType DWord -Value 5 -Force + # Descriptive name format for the restore point: ..