diff --git a/Win 10.ps1 b/Win 10.ps1 index 809c8202..db4def99 100644 --- a/Win 10.ps1 +++ b/Win 10.ps1 @@ -16,10 +16,10 @@ Strongly recommended to run the script after fresh installation. Some of functions can be run also on LTSB/LTSC and on older versions of Windows and PowerShell (not recommended to run on the x86 systems). .EXAMPLE - PS C:\WINDOWS\system32> & '.\Win 10.ps1' + PS C:\> & '.\Win 10.ps1' .NOTES - Version: v4.0.33 - Date: 20.04.2020 + Version: v4.0.34 + Date: 28.04.2020 Written by: farag Thanks to all http://forum.ru-board.com members involved Ask a question on @@ -36,7 +36,7 @@ #Requires -Version 5 #region Preparation -# Set-StrictMode -Version Latest +Set-StrictMode -Version Latest Clear-Host # Get information about the current culture settings @@ -45,6 +45,11 @@ if ($PSUICulture -eq "ru-RU") { $RU = $true } +else +{ + $RU = $false +} + # Detect the OS bitness # Определить разрядность ОС if (-not ([Environment]::Is64BitOperatingSystem)) @@ -59,6 +64,7 @@ if (-not ([Environment]::Is64BitOperatingSystem)) } break } + # Detect the PowerShell bitness # Определить разрядность PowerShell if (-not ([IntPtr]::Size -eq 8)) @@ -79,6 +85,7 @@ if (-not ([IntPtr]::Size -eq 8)) # Сlear $Error variable # Очистка переменной $Error $Error.Clear() + # Set the encoding to UTF-8 without BOM for the PowerShell session # Установить кодировку UTF-8 без BOM для текущей сессии PowerShell if ($RU) @@ -86,6 +93,133 @@ if ($RU) ping.exe | Out-Null $OutputEncoding = [System.Console]::OutputEncoding = [System.Console]::InputEncoding = [System.Text.Encoding]::UTF8 } + +# Create a restore point +# Создать точку восстановления +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 +} +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 +} +do +{ + $Prompt = Read-Host -Prompt " " + if ([string]::IsNullOrEmpty($Prompt)) + { + break + } + else + { + switch ($Prompt) + { + "Y" + { + 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: , ,