Skip to content

Commit ef439cf

Browse files
authored
11.11.2019
## Updated - Added the OS bitness and PowerShell session detection; - Minor changes. ## Обновлено - Добавлено определение разрядности ОС и сеанса PowerShell; - Незначительные изменения.
1 parent 0cc06e4 commit ef439cf

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

Win 10.ps1

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,50 @@
11
#Requires -RunAsAdministrator
2+
#Requires -Version 5
23

3-
#region Begin
4-
# Remove all text from the current display
5-
# Очистить экран
4+
#region Preparation
65
Clear-Host
7-
# Сlear $Error variable
8-
# Очистка переменной $Error
9-
$Error.Clear()
6+
107
# Get information about the current culture settings
118
# Получить сведения о параметрах текущей культуры
129
IF ($PSUICulture -eq "ru-RU")
1310
{
1411
$RU = $true
1512
}
13+
# Detect the OS bitness
14+
# Определить разрядность ОС
15+
IF (-not ([Environment]::Is64BitOperatingSystem))
16+
{
17+
IF ($RU)
18+
{
19+
Write-Host "The script supports Windows 10 x64 only" -BackgroundColor Red
20+
}
21+
else
22+
{
23+
Write-Host "Скрипт поддерживает только Windows 10 x64" -BackgroundColor Red
24+
}
25+
break
26+
}
27+
# Detect the PowerShell bitness
28+
# Определить разрядность PowerShell
29+
IF (-not ([IntPtr]::Size -eq 8))
30+
{
31+
IF ($RU)
32+
{
33+
Write-Host "The script supports PowerShell x64 only" -BackgroundColor Red
34+
}
35+
else
36+
{
37+
Write-Host "Скрипт поддерживает только PowerShell x64" -BackgroundColor Red
38+
}
39+
break
40+
}
41+
42+
#endregion Preparation
43+
44+
#region Begin
45+
# Сlear $Error variable
46+
# Очистка переменной $Error
47+
$Error.Clear()
1648
# Set the encoding to UTF-8 without BOM for the PowerShell session
1749
# Установить кодировку UTF-8 без BOM для текущей сессии PowerShell
1850
IF ($RU)

0 commit comments

Comments
 (0)