diff --git a/Win 10.ps1 b/Win 10.ps1 index 046bb834..a6d22a0c 100644 --- a/Win 10.ps1 +++ b/Win 10.ps1 @@ -3,7 +3,9 @@ "Windows 10 Setup Script" is a set of tweaks for OS fine-tuning and automating the routine tasks. .DESCRIPTION Supported Windows versions: - Windows 10 1903/1909 (19H1/19H2), 18362/18363 build, x64 only. Tested on Pro/Enterprise editions. + Windows 10 1903/1909 (19H1/19H2), 18362/18363 build, x64 only + + Tested on Home/Pro/Enterprise editions Check whether file is encoded in UTF-8 with BOM. PowerShell must be run with elevated privileges; @@ -18,8 +20,8 @@ .EXAMPLE PS C:\> & '.\Win 10.ps1' .NOTES - Version: v4.1 - Date: 03.05.2020 + Version: v4.2 + Date: 12.05.2020 Written by: farag Thanks to all http://forum.ru-board.com members involved Ask a question on @@ -79,6 +81,21 @@ if (-not ([IntPtr]::Size -eq 8)) } break } + +# 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 @@ -100,128 +117,86 @@ if ($RU) # Создать точку восстановления if ($RU) { - Write-Host "`nЧтобы создать точку восстановления, введите букву: " -NoNewline - Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline - Write-Host " или " -NoNewline - Write-Host "[N]o" -ForegroundColor Yellow -NoNewline - Write-Host ", чтобы пропустить" -NoNewline - Write-Host "`nТакже, чтобы пропустить, нажмите Enter" -NoNewline + $Title = "Точка восстановления" + $Message = "Чтобы создайте точку восстановления, введите необходимую букву" + $Options = "&Создать", "&Не создавать", "&Пропустить" } else { - Write-Host "`nTo сreate a restore point type: " -NoNewline - Write-Host "[Y]es" -ForegroundColor Yellow -NoNewline - Write-Host " or " -NoNewline - Write-Host "[N]o" -ForegroundColor Yellow -NoNewline - Write-Host " to skip" -NoNewline - Write-Host "`nAlso press Enter to skip" -NoNewline + $Title = "Restore point" + $Message = "To create a restore point enter the required letter" + $Options = "&Create", "&Do not create", "&Skip" } -do +$DefaultChoice = 2 +$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice) + +switch ($Result) { - $Prompt = Read-Host -Prompt " " - if ([string]::IsNullOrEmpty($Prompt)) + "0" { - break + 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: ..