Browse Source

v4.4 02.06.2020

Diff from v4.3.0.1
<https://github.com/farag2/Windows-10-Setup-Script/compare/4.3.0.1...4.4>

## Updated

- Updated links in the comment-based help section;
- Updated "Increase taskbar transparency" section
  - Removed "ForceEffectMode" key, that blocked Windows 10 transparency effects
  - To remove unnecessary key, execute

  ```powershell
  # Restart needed
  Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\Dwm -Name ForceEffectMode -Force
  ```

- Updated "Change location of the user folders" section
  - Added comment-based section;
  - Added the ability to skip (#25)
- Updated "Uninstall UWP apps" section
  - Added "Uninstall for All Users" button to the form (unchecked by default) (@oz-zo)
- Add the "Run as different user" item to the .exe files types context menu
  - Removed unnecessary keys
- Comments;
- Minor changes;
- Also you can test [20H1 version.](https://gist.github.com/farag2/5a6d9952247aefe42ba81a9d95507765)

Отличия от v4.3.0.1
<https://github.com/farag2/Windows-10-Setup-Script/compare/4.3.0.1...4.4>

## Обновлено

- Обновлены ссылки в разделе со справке;
- Обновлен раздел "Увеличить прозрачность панели задач"
  - Удален ключ "ForceEffectMode", который блокировал эффекты прозрачности Windows 10
  - Чтобы удалить ненужный ключ, выполните

  ```powershell
  # Необходима перезагрузка
   Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\Dwm -Name ForceEffectMode -Force
   ```

- Обновлен раздел "Изменить расположение пользовательских папок"
  - У функции добавлена справка по использованию;
  - Добавлена возможность пропустить использование функции (#25)
- Обновлен раздел "Удалить UWP-приложения"
  - В форму удаления добавлена кнопка "Удалять для всех пользователей" (по умолчанию снята) (@oz-zo)
- Обновлен раздел "Добавить "Запуск от имени другого пользователя" в контекстное меню .exe файлов"
  - Удалены ненужные ключи
- Комментарии;
- Незначительные изменения;
- Также можете протестировать [версию 20H1.](https://gist.github.com/farag2/5a6d9952247aefe42ba81a9d95507765)
pull/26/head 4.4
Dmitry Nefedov 5 years ago
committed by GitHub
parent
commit
d304281616
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 501
      Win 10.ps1

501
Win 10.ps1

@ -21,17 +21,19 @@
.EXAMPLE .EXAMPLE
PS C:\> & '.\Win 10.ps1' PS C:\> & '.\Win 10.ps1'
.NOTES .NOTES
Version: v4.3 Version: v4.4
Date: 21.05.2020 Date: 02.06.2020
Written by: farag Written by: farag & oZ-Zo
Thanks to all http://forum.ru-board.com members involved Thanks to all http://forum.ru-board.com members involved
Ask a question on Ask a question on
- http://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 http://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15
- https://habr.com/en/post/465365/ https://habr.com/en/post/465365/
- https://4pda.ru/forum/index.php?s=&showtopic=523489&view=findpost&p=95909388 https://4pda.ru/forum/index.php?showtopic=523489&st=42860#entry95909388
- https://forums.mydigitallife.net/threads/powershell-script-setup-windows-10.80139/ https://forums.mydigitallife.net/threads/powershell-script-setup-windows-10.81675/
- https://www.reddit.com/r/Windows10/comments/ctg8jw/powershell_script_setup_windows_10/ https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/
Copyright (c) 2020 farag
Copyright (c) 2020 farag & oZ-Zo
.LINK .LINK
https://github.com/farag2/Windows-10-Setup-Script https://github.com/farag2/Windows-10-Setup-Script
#> #>
@ -55,8 +57,10 @@ else
# Detect the OS bitness # Detect the OS bitness
# Определить разрядность ОС # Определить разрядность ОС
if (-not ([Environment]::Is64BitOperatingSystem)) switch ([Environment]::Is64BitOperatingSystem)
{ {
$false
{
if ($RU) if ($RU)
{ {
Write-Warning -Message "Скрипт поддерживает только Windows 10 x64" Write-Warning -Message "Скрипт поддерживает только Windows 10 x64"
@ -66,12 +70,16 @@ if (-not ([Environment]::Is64BitOperatingSystem))
Write-Warning -Message "The script supports Windows 10 x64 only" Write-Warning -Message "The script supports Windows 10 x64 only"
} }
break break
}
Default {}
} }
# Detect the PowerShell bitness # Detect the PowerShell bitness
# Определить разрядность PowerShell # Определить разрядность PowerShell
if (-not ([IntPtr]::Size -eq 8)) switch ([IntPtr]::Size -eq 8)
{ {
$false
{
if ($RU) if ($RU)
{ {
Write-Warning -Message "Скрипт поддерживает только PowerShell x64" Write-Warning -Message "Скрипт поддерживает только PowerShell x64"
@ -81,6 +89,8 @@ if (-not ([IntPtr]::Size -eq 8))
Write-Warning -Message "The script supports PowerShell x64 only" Write-Warning -Message "The script supports PowerShell x64 only"
} }
break break
}
Default {}
} }
# Detect whether the script is running via PowerShell ISE # Detect whether the script is running via PowerShell ISE
@ -229,7 +239,7 @@ New-ItemProperty -Path HKLM:\System\CurrentControlSet\Services\UserDataSvc -Name
# Stop event trace sessions # Stop event trace sessions
# Остановить сеансы отслеживания событий # Остановить сеансы отслеживания событий
Get-EtwTraceSession -Name DiagLog -ErrorAction Ignore | Remove-EtwTraceSession Get-EtwTraceSession -Name DiagLog -ErrorAction Ignore | Remove-EtwTraceSession -ErrorAction Ignore
# Turn off the data collectors at the next computer restart # Turn off the data collectors at the next computer restart
# Отключить сборщики данных при следующем запуске ПК # Отключить сборщики данных при следующем запуске ПК
@ -428,7 +438,6 @@ New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\
# Increase taskbar transparency # Increase taskbar transparency
# Увеличить прозрачность панели задач # Увеличить прозрачность панели задач
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name UseOLEDTaskbarTransparency -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name UseOLEDTaskbarTransparency -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\Dwm -Name ForceEffectMode -PropertyType DWord -Value 1 -Force
# Do not show when snapping a window, what can be attached next to it # Do not show when snapping a window, what can be attached next to it
# Не показывать при прикреплении окна, что можно прикрепить рядом с ним # Не показывать при прикреплении окна, что можно прикрепить рядом с ним
@ -693,12 +702,14 @@ if ($UninstallString)
{ {
Write-Verbose -Message "Uninstalling OneDrive" -Verbose Write-Verbose -Message "Uninstalling OneDrive" -Verbose
} }
Stop-Process -Name OneDrive -Force Stop-Process -Name OneDrive -Force -ErrorAction Ignore
Stop-Process -Name FileCoAuth -ErrorAction Ignore -Force Stop-Process -Name FileCoAuth -Force -ErrorAction Ignore
# Save all opened folders in order to restore them after File Explorer restarting # Save all opened folders in order to restore them after File Explorer restarting
# Сохранить все открытые папки, чтобы восстановить их после перезапуска проводника # Сохранить все открытые папки, чтобы восстановить их после перезапуска проводника
Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore Clear-Variable -Name OpenedFolders -Force -ErrorAction Ignore
$OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke() $OpenedFolders = {(New-Object -ComObject Shell.Application).Windows() | ForEach-Object -Process {$_.Document.Folder.Self.Path}}.Invoke()
# Getting link to the OneDriveSetup.exe and its' argument(s) # Getting link to the OneDriveSetup.exe and its' argument(s)
# Получаем ссылку на OneDriveSetup.exe и его аргумент(ы) # Получаем ссылку на OneDriveSetup.exe и его аргумент(ы)
[string[]]$OneDriveSetup = ($UninstallString -Replace("\s*/",",/")).Split(",").Trim() [string[]]$OneDriveSetup = ($UninstallString -Replace("\s*/",",/")).Split(",").Trim()
@ -711,6 +722,7 @@ if ($UninstallString)
Start-Process -FilePath $OneDriveSetup[0] -ArgumentList $OneDriveSetup[1..2] -Wait Start-Process -FilePath $OneDriveSetup[0] -ArgumentList $OneDriveSetup[1..2] -Wait
} }
Stop-Process -Name explorer -Force Stop-Process -Name explorer -Force
# Restoring closed folders # Restoring closed folders
# Восстановляем закрытые папки # Восстановляем закрытые папки
foreach ($OpenedFolder in $OpenedFolders) foreach ($OpenedFolder in $OpenedFolders)
@ -720,6 +732,7 @@ if ($UninstallString)
Invoke-Item -Path $OpenedFolder Invoke-Item -Path $OpenedFolder
} }
} }
# Getting the OneDrive user folder path # Getting the OneDrive user folder path
# Получаем путь до папки пользователя OneDrive # Получаем путь до папки пользователя OneDrive
$OneDriveUserFolder = Get-ItemPropertyValue -Path HKCU:\Environment -Name OneDrive $OneDriveUserFolder = Get-ItemPropertyValue -Path HKCU:\Environment -Name OneDrive
@ -739,12 +752,14 @@ if ($UninstallString)
} }
Invoke-Item -Path $OneDriveUserFolder Invoke-Item -Path $OneDriveUserFolder
} }
Remove-ItemProperty -Path HKCU:\Environment -Name OneDrive, OneDriveConsumer -Force -ErrorAction Ignore Remove-ItemProperty -Path HKCU:\Environment -Name OneDrive, OneDriveConsumer -Force -ErrorAction Ignore
Remove-Item -Path HKCU:\Software\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore Remove-Item -Path HKCU:\Software\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore
Remove-Item -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore Remove-Item -Path HKLM:\SOFTWARE\WOW6432Node\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore
Remove-Item -Path "$env:ProgramData\Microsoft OneDrive" -Recurse -Force -ErrorAction Ignore Remove-Item -Path "$env:ProgramData\Microsoft OneDrive" -Recurse -Force -ErrorAction Ignore
Remove-Item -Path $env:SystemDrive\OneDriveTemp -Recurse -Force -ErrorAction Ignore Remove-Item -Path $env:SystemDrive\OneDriveTemp -Recurse -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskName *OneDrive* -Confirm:$false Unregister-ScheduledTask -TaskName *OneDrive* -Confirm:$false
# Getting the OneDrive folder path # Getting the OneDrive folder path
# Получаем путь до папки OneDrive # Получаем путь до папки OneDrive
$OneDriveFolder = Split-Path -Path (Split-Path -Path $OneDriveSetup[0] -Parent) $OneDriveFolder = Split-Path -Path (Split-Path -Path $OneDriveSetup[0] -Parent)
@ -781,9 +796,11 @@ if ($UninstallString)
} }
while ($Locked) while ($Locked)
} }
Remove-Item -Path $OneDriveFolder -Recurse -Force
Remove-Item -Path $OneDriveFolder -Recurse -Force -ErrorAction Ignore
Remove-Item -Path $env:LOCALAPPDATA\OneDrive -Recurse -Force -ErrorAction Ignore Remove-Item -Path $env:LOCALAPPDATA\OneDrive -Recurse -Force -ErrorAction Ignore
Remove-Item -Path $env:LOCALAPPDATA\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore Remove-Item -Path $env:LOCALAPPDATA\Microsoft\OneDrive -Recurse -Force -ErrorAction Ignore
Remove-Item -Path "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" -Force -ErrorAction Ignore
} }
#endregion OneDrive #endregion OneDrive
@ -973,7 +990,7 @@ $ExcludedCapabilities = @(
<Window <Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="Window" Title="Capabilities to uninstall" Name="Window"
MinHeight="450" MinWidth="400" MinHeight="450" MinWidth="400"
SizeToContent="Width" WindowStartupLocation="CenterScreen" SizeToContent="Width" WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True" TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True"
@ -1004,7 +1021,7 @@ $ExcludedCapabilities = @(
VerticalScrollBarVisibility="Auto"> VerticalScrollBarVisibility="Auto">
<StackPanel Name="PanelContainer" Orientation="Vertical"/> <StackPanel Name="PanelContainer" Orientation="Vertical"/>
</ScrollViewer> </ScrollViewer>
<Button Name="Button" Grid.Row="1" Content="Uninstall"/> <Button Name="Button" Grid.Row="1"/>
</Grid> </Grid>
</Window> </Window>
' '
@ -1103,6 +1120,17 @@ $Window.Add_Loaded({
Add-CapabilityControl -Capability $_ Add-CapabilityControl -Capability $_
} }
$OFS = " " $OFS = " "
if ($RU)
{
$Window.Title = "Удалить дополнительные компоненты"
$Button.Content = "Удалить"
}
else
{
$Window.Title = "Capabilities to Uninstall"
$Button.Content = "Uninstall"
}
}) })
# Button Click Event # Button Click Event
@ -1117,10 +1145,10 @@ if (Get-WindowsCapability -Online | Where-Object -FilterScript {($_.State -eq "I
} }
else else
{ {
Write-Verbose "Form opening..." -Verbose Write-Verbose -Message "Form opening..." -Verbose
} }
# Display form # Display form
# Display форму # Отобразить форму
$Form.ShowDialog() | Out-Null $Form.ShowDialog() | Out-Null
} }
else else
@ -1131,7 +1159,7 @@ else
} }
else else
{ {
Write-Verbose "Отсутствуют дополнительные компоненты для отображения" -Verbose Write-Verbose -Message "Отсутствуют дополнительные компоненты для отображения" -Verbose
} }
} }
@ -1244,8 +1272,17 @@ if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -eq "Pro
# Change location of the user folders # Change location of the user folders
# Изменить расположение пользовательских папок # Изменить расположение пользовательских папок
<#
.SYNOPSIS
Change location of the each user folders using SHSetKnownFolderPath function
.EXAMPLE
UserShellFolder -UserFolder Desktop -FolderPath "C:\Desktop"
.NOTES
User files or folders won't me moved to the new location
#>
function KnownFolderPath function KnownFolderPath
{ {
[CmdletBinding()]
param param
( (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
@ -1287,6 +1324,7 @@ function KnownFolderPath
function UserShellFolder function UserShellFolder
{ {
[CmdletBinding()]
param param
( (
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
@ -1317,6 +1355,8 @@ function UserShellFolder
"Videos" = "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}" "Videos" = "{35286A68-3C57-41A1-BBB1-0EAE73D76C95}"
} }
# Hidden desktop.ini for each type of user folders
# Скрытый desktop.ini для каждого типа пользовательских папок
$DesktopINI = @{ $DesktopINI = @{
"Desktop" = "", "Desktop" = "",
"[.ShellClassInfo]", "[.ShellClassInfo]",
@ -1351,6 +1391,8 @@ function UserShellFolder
"IconFile=%SystemRoot%\system32\shell32.dll","IconIndex=-238" "IconFile=%SystemRoot%\system32\shell32.dll","IconIndex=-238"
} }
# Checking the current user folder path
# Проверяем текущее значение пути пользовательской папки
$UserShellFolderRegValue = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersRegName[$UserFolder] $UserShellFolderRegValue = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersRegName[$UserFolder]
if ($UserShellFolderRegValue -ne $FolderPath) if ($UserShellFolderRegValue -ne $FolderPath)
{ {
@ -1365,23 +1407,36 @@ function UserShellFolder
Write-Error -Message "Some files left in the $UserShellFolderRegValue folder. Move them manually to a new location" -ErrorAction SilentlyContinue Write-Error -Message "Some files left in the $UserShellFolderRegValue folder. Move them manually to a new location" -ErrorAction SilentlyContinue
} }
} }
# Creating a new folder if there is no one
# Создаем новую папку, если таковая отсутствует
if (-not (Test-Path -Path $FolderPath)) if (-not (Test-Path -Path $FolderPath))
{ {
New-Item -Path $FolderPath -ItemType Directory -Force New-Item -Path $FolderPath -ItemType Directory -Force
} }
KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath KnownFolderPath -KnownFolder $UserFolder -Path $FolderPath
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUID[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name $UserShellFoldersGUID[$UserFolder] -PropertyType ExpandString -Value $FolderPath -Force
Set-Content -Path "$FolderPath\desktop.ini" -Value $DesktopINI[$UserFolder] -Encoding Unicode -Force Set-Content -Path "$FolderPath\desktop.ini" -Value $DesktopINI[$UserFolder] -Encoding Unicode -Force
(Get-Item -Path "$FolderPath\desktop.ini" -Force).Attributes = "Hidden", "System", "Archive" (Get-Item -Path "$FolderPath\desktop.ini" -Force).Attributes = "Hidden", "System", "Archive"
(Get-Item -Path "$FolderPath\desktop.ini" -Force).Refresh() (Get-Item -Path "$FolderPath\desktop.ini" -Force).Refresh()
} }
} }
<#
.SYNOPSIS
The "Show menu" function using PowerShell with the up/down arrow keys and enter key to make a selection
.EXAMPLE
ShowMenu -Menu $ListOfItems -Default $DefaultChoice
.NOTES
Doesn't work in PowerShell ISE
#>
function ShowMenu function ShowMenu
{ {
[CmdletBinding()]
param param
( (
[Parameter(Mandatory = $true)] [Parameter()]
[string] [string]
$Title, $Title,
@ -1452,11 +1507,14 @@ function ShowMenu
while ($k.Key -notin ([ConsoleKey]::Escape, [ConsoleKey]::Enter)) while ($k.Key -notin ([ConsoleKey]::Escape, [ConsoleKey]::Enter))
} }
# Store all drives letters to use them within ShowMenu function
# Сохранить все буквы диска, чтобы использовать их в функции ShowMenu
$DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object) $DriveLetters = @((Get-Disk | Where-Object -FilterScript {$_.BusType -ne "USB"} | Get-Partition | Get-Volume | Where-Object -FilterScript {$null -ne $_.DriveLetter}).DriveLetter | Sort-Object)
if ($DriveLetters.Count -gt 1) if ($DriveLetters.Count -gt 1)
{ {
# If drive letters count is more than, then make the second drive in the list the default drive # If the number of disks is more than one, set the second drive in the list as default drive
# Если количество букв дисков больше одного, то сделать второй диск в списке диском по умолчанию # Если количество дисков больше одного, сделать второй диск в списке диском по умолчанию
$Default = 1 $Default = 1
} }
else else
@ -1466,81 +1524,280 @@ else
# Desktop # Desktop
# Рабочий стол # Рабочий стол
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Рабочий стол`".`nФайлы не будут перенесены: сделайте это вручную" $Message = "Чтобы изменить местоположение папки `"Рабочий стол`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Desktop`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Desktop folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Рабочий стол`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Desktop`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Desktop -FolderPath "${SelectedDrive}:\Desktop"
# Documents # Documents
# Документы # Документы
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Документы`".`nФайлы не будут перенесены: сделайте это вручную" $Message = "Чтобы изменить местоположение папки `"Документы`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Documents`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Documents folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Документы`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Documents`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Documents -FolderPath "${SelectedDrive}:\Documents"
# Downloads # Downloads
# Загрузки # Загрузки
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Загрузки`"" $Message = "Чтобы изменить местоположение папки `"Загрузки`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Downloads`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Downloads folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Загрузки`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Downloads`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Downloads -FolderPath "${SelectedDrive}:\Downloads"
# Music # Music
# Музыка # Музыка
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Музыка`".`nФайлы не будут перенесены: сделайте это вручную" $Message = "Чтобы изменить местоположение папки `"Музыка`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Music`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Music folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default $DefaultChoice = 1
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music" $Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Музыка`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Music`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Music -FolderPath "${SelectedDrive}:\Music"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
}
# Pictures # Pictures
# Изображения # Изображения
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Изображения`".`nФайлы не будут перенесены: сделайте это вручную" $Message = "Чтобы изменить местоположение папки `"Изображения`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Pictures`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Pictures folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Изображения`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Pictures`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Pictures -FolderPath "${SelectedDrive}:\Pictures"
# Videos # Videos
# Видео # Видео
$Title = ""
if ($RU) if ($RU)
{ {
$Title = "Выберите букву диска, в корне которого будет создана папка для `"Видео`".`nФайлы не будут перенесены: сделайте это вручную" $Message = "Чтобы изменить местоположение папки `"Видео`", введите необходимую букву"
Write-Warning "`nФайлы не будут перенесены"
$Options = "&Изменить", "&Пропустить"
} }
else else
{ {
$Title = "Choose the drive letter in the root of which the `"Videos`" folder will be created.`nFiles will not be moved. Do it manually" $Message = "To change the location of the Videos folder enter the required letter"
Write-Warning "`nFiles will not be moved"
$Options = "&Change", "&Skip"
}
$DefaultChoice = 1
$Result = $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
switch ($Result)
{
"0"
{
if ($RU)
{
$Title = "`nВыберите диск, в корне которого будет создана папка для `"Видео`""
}
else
{
$Title = "`nSelect the drive within the root of which the `"Videos`" folder will be created"
}
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos"
}
"1"
{
if ($RU)
{
Write-Verbose -Message "Пропущено" -Verbose
}
else
{
Write-Verbose -Message "Skipped" -Verbose
}
}
} }
$SelectedDrive = ShowMenu -Title $Title -Menu $DriveLetters -Default $Default
UserShellFolder -UserFolder Videos -FolderPath "${SelectedDrive}:\Videos"
# Turn on automatic recommended troubleshooting and tell when problems get fixed # Turn on automatic recommended troubleshooting and tell when problems get fixed
# Автоматически запускать средства устранения неполадок, а затем сообщать об устранении проблем # Автоматически запускать средства устранения неполадок, а затем сообщать об устранении проблем
@ -1569,7 +1826,7 @@ if (-not (Test-Path -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b1
{ {
New-Item -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win64" -Force New-Item -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win64" -Force
} }
New-ItemProperty -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win64" -Name "(default)" -PropertyType String -Value "" -Force New-ItemProperty -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win64" -Name "(Default)" -PropertyType String -Value "" -Force
# Turn on Num Lock at startup # Turn on Num Lock at startup
# Включить Num Lock при загрузке # Включить Num Lock при загрузке
@ -1633,7 +1890,7 @@ $Data += ",5,134,145,204,147,5,36,170,163,1,68,195,132,1,102,159,247,157,177,135
$Data += ",194,60,1,194,70,1,197,90,1,0" $Data += ",194,60,1,194,70,1,197,90,1,0"
New-ItemProperty -Path $StartMenu.PSPath -Name Data -PropertyType Binary -Value $Data.Split(",") -Force New-ItemProperty -Path $StartMenu.PSPath -Name Data -PropertyType Binary -Value $Data.Split(",") -Force
# Unpin all the Start menu tiles # Unpin all the Start tiles
# Открепить все ярлыки от начального экрана # Открепить все ярлыки от начального экрана
if ($RU) if ($RU)
{ {
@ -1695,13 +1952,14 @@ else
{ {
if ($RU) if ($RU)
{ {
Write-Warning "Отсутствует интернет-соединение" -ErrorAction SilentlyContinue Write-Warning -Message "Отсутствует интернет-соединение" -ErrorAction SilentlyContinue
} }
else else
{ {
Write-Warning "No Internet connection" -ErrorAction SilentlyContinue Write-Warning -Message "No Internet connection" -ErrorAction SilentlyContinue
} }
} }
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog $OpenFileDialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
$OpenFileDialog.InitialDirectory = $DownloadsFolder $OpenFileDialog.InitialDirectory = $DownloadsFolder
@ -1718,6 +1976,7 @@ else
# Перевести фокус на диалог открытия файла # Перевести фокус на диалог открытия файла
$tmp = New-Object -TypeName System.Windows.Forms.Form -Property @{TopMost = $true} $tmp = New-Object -TypeName System.Windows.Forms.Form -Property @{TopMost = $true}
$OpenFileDialog.ShowDialog($tmp) $OpenFileDialog.ShowDialog($tmp)
if ($OpenFileDialog.FileName) if ($OpenFileDialog.FileName)
{ {
# Pin "Control Panel" to Start # Pin "Control Panel" to Start
@ -1755,6 +2014,7 @@ if ($OpenFileDialog.FileName)
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait
Remove-Item -Path "$env:SystemRoot\System32\$ControlPanelLocalizedName.lnk" -Force Remove-Item -Path "$env:SystemRoot\System32\$ControlPanelLocalizedName.lnk" -Force
} }
# Pin "Devices and Printers" to Start # Pin "Devices and Printers" to Start
# Create old style shortcut for the "Devices and Printers" in the Start menu # Create old style shortcut for the "Devices and Printers" in the Start menu
# Закрепить "Устройства и принтеры" на начальном экране # Закрепить "Устройства и принтеры" на начальном экране
@ -1781,6 +2041,7 @@ if ($OpenFileDialog.FileName)
"$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesAndPrintersLocalizedName.lnk" "51201" "$env:APPDATA\Microsoft\Windows\Start menu\Programs\System Tools\$DevicesAndPrintersLocalizedName.lnk" "51201"
"@ "@
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait
# Pin "Command Prompt" to Start # Pin "Command Prompt" to Start
# Закрепить "Командную строку" на начальном экране # Закрепить "Командную строку" на начальном экране
if ($RU) if ($RU)
@ -1796,9 +2057,11 @@ if ($OpenFileDialog.FileName)
"@ "@
Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait Start-Process -FilePath $OpenFileDialog.FileName -WindowStyle Hidden -ArgumentList $Arguments -Wait
} }
# Delete downloaded syspin.exe # Delete downloaded syspin.exe
# Удалить скачанный syspin.exe # Удалить скачанный syspin.exe
Remove-Item -Path "$DownloadsFolder\syspin.exe" -Force Remove-Item -Path "$DownloadsFolder\syspin.exe" -Force
# Restart the Start menu # Restart the Start menu
# Перезапустить меню "Пуск" # Перезапустить меню "Пуск"
Stop-Process -Name StartMenuExperienceHost -Force Stop-Process -Name StartMenuExperienceHost -Force
@ -1831,12 +2094,12 @@ New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer
Uninstall UWP apps from all accounts Uninstall UWP apps from all accounts
A form with the ability to select the package to remove A form with the ability to select the package to remove
App packages will not be installed when new user accounts are created App packages will not be installed when new user accounts are created
Add UWP apps packages names to the $UnchekedAppXPackages array list by retrieving their packages names with (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers).Name command Add UWP apps packages names to the $UncheckedAppXPackages array list by retrieving their packages names with (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers).Name command
Удалить UWP-приложения из всех учетных записей Удалить UWP-приложения из всех учетных записей
Форма с возможностью выбрать пакет для удаления Форма с возможностью выбрать пакет для удаления
Приложения не будут установлены при создании новых учетных записей Приложения не будут установлены при создании новых учетных записей
Добавьте имена пакетов UWP-приложений в массив $UnchekedAppXPackages, получив названия их пакетов с помощью команды (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers).Name Добавьте имена пакетов UWP-приложений в массив $UncheckedAppXPackages, получив названия их пакетов с помощью команды (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers).Name
#> #>
Add-Type -AssemblyName PresentationCore, PresentationFramework Add-Type -AssemblyName PresentationCore, PresentationFramework
@ -1909,7 +2172,7 @@ $ExcludedAppxPackages = @(
<Window <Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="Window" Title="Packages to uninstall" Name="Window"
MinHeight="450" MinWidth="400" MinHeight="450" MinWidth="400"
SizeToContent="Width" WindowStartupLocation="CenterScreen" SizeToContent="Width" WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True" TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True"
@ -1932,15 +2195,26 @@ $ExcludedAppxPackages = @(
</Window.Resources> </Window.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<ScrollViewer Name="Scroll" Grid.Row="0" <Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<CheckBox Name="CheckboxRemoveAll" IsChecked="False"/>
<TextBlock Name="TextblockRemoveAll"/>
</StackPanel>
</Grid>
<ScrollViewer Name="Scroll" Grid.Row="1"
HorizontalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"> VerticalScrollBarVisibility="Auto">
<StackPanel Name="PanelContainer" Orientation="Vertical"/> <StackPanel Name="PanelContainer" Orientation="Vertical"/>
</ScrollViewer> </ScrollViewer>
<Button Name="Button" Grid.Row="1" Content="Uninstall"/> <Button Name="Button" Grid.Row="2"/>
</Grid> </Grid>
</Window> </Window>
' '
@ -1989,7 +2263,14 @@ function DeleteButton
{ {
[void]$Window.Close() [void]$Window.Close()
$OFS = "|" $OFS = "|"
if ($CheckboxRemoveAll.IsChecked)
{
Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Where-Object -FilterScript {$_.Name -cmatch $AppxPackages} | Remove-AppxPackage -AllUsers -Verbose Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Where-Object -FilterScript {$_.Name -cmatch $AppxPackages} | Remove-AppxPackage -AllUsers -Verbose
}
else
{
Get-AppxPackage -PackageTypeFilter Bundle | Where-Object -FilterScript {$_.Name -cmatch $AppxPackages} | Remove-AppxPackage -Verbose
}
$OFS = " " $OFS = " "
} }
@ -2041,6 +2322,19 @@ $Window.Add_Loaded({
Add-AppxControl -AppxName $_ Add-AppxControl -AppxName $_
} }
$OFS = " " $OFS = " "
if ($RU)
{
$TextblockRemoveAll.Text = "Удалять для всех пользователей"
$Window.Title = "Удалить UWP-приложения"
$Button.Content = "Удалить"
}
else
{
$TextblockRemoveAll.Text = "Uninstall for All Users"
$Window.Title = "UWP Packages to Uninstall"
$Button.Content = "Uninstall"
}
}) })
# Button Click Event # Button Click Event
@ -2055,10 +2349,10 @@ if (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Where-Object -FilterSc
} }
else else
{ {
Write-Verbose "Form opening..." -Verbose Write-Verbose -Message "Form opening..." -Verbose
} }
# Display form # Display form
# Display форму # Отобразить форму
$Form.ShowDialog() | Out-Null $Form.ShowDialog() | Out-Null
} }
else else
@ -2069,7 +2363,7 @@ else
} }
else else
{ {
Write-Verbose "Отсутствуют UWP-приложения для отображения" -Verbose Write-Verbose -Message "Отсутствуют UWP-приложения для отображения" -Verbose
} }
} }
@ -2166,7 +2460,7 @@ if (Get-CimInstance -ClassName Win32_VideoController | Where-Object -FilterScrip
{ {
$OpenFileDialog.Filter = "*.exe|*.exe|All Files (*.*)|*.*" $OpenFileDialog.Filter = "*.exe|*.exe|All Files (*.*)|*.*"
} }
$OpenFileDialog.InitialDirectory = "$env:ProgramFiles}" $OpenFileDialog.InitialDirectory = "${env:ProgramFiles(x86)}"
$OpenFileDialog.Multiselect = $false $OpenFileDialog.Multiselect = $false
# Focus on open file dialog # Focus on open file dialog
# Перевести фокус на диалог открытия файла # Перевести фокус на диалог открытия файла
@ -2242,7 +2536,7 @@ if ($PSUICulture -eq "ru-RU")
<toast launch="app-defined-string"> <toast launch="app-defined-string">
<visual> <visual>
<binding template="ToastGeneric"> <binding template="ToastGeneric">
<text>Очистка неиспользуемых обновлений начнется через минуту</text> <text>Очистка неиспользуемых файлов и обновлений Windows начнется через минуту</text>
</binding> </binding>
</visual> </visual>
<actions> <actions>
@ -2257,7 +2551,7 @@ else
<toast launch="app-defined-string"> <toast launch="app-defined-string">
<visual> <visual>
<binding template="ToastGeneric"> <binding template="ToastGeneric">
<text>Cleaning up unused updates will start in a minute</text> <text>Cleaning up unused Windows files and updates start in a minute</text>
</binding> </binding>
</visual> </visual>
<actions> <actions>
@ -2276,7 +2570,7 @@ Start-Sleep -Seconds 60
# Process startup info # Process startup info
# Параметры запуска процесса # Параметры запуска процесса
$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo $ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
$ProcessInfo.FileName = "$env:SystemRoot\system32\cleanmgr.exe" $ProcessInfo.FileName = "$env:SystemRoot\system32\cleanmgr.exe"
$ProcessInfo.Arguments = "/sagerun:1337" $ProcessInfo.Arguments = "/sagerun:1337"
$ProcessInfo.UseShellExecute = $true $ProcessInfo.UseShellExecute = $true
@ -2331,7 +2625,7 @@ while ($true)
Start-Sleep -Milliseconds 5 Start-Sleep -Milliseconds 5
} }
$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo $ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
# Cleaning up unused updates # Cleaning up unused updates
# Очистка неиспользованных обновлений # Очистка неиспользованных обновлений
$ProcessInfo.FileName = "$env:SystemRoot\system32\dism.exe" $ProcessInfo.FileName = "$env:SystemRoot\system32\dism.exe"
@ -2577,23 +2871,23 @@ switch ($Result)
"0" "0"
{ {
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$OpenFileDialog = New-Object -TypeName System.Windows.Forms.FolderBrowserDialog $FolderBrowserDialog = New-Object -TypeName System.Windows.Forms.FolderBrowserDialog
if ($RU) if ($RU)
{ {
$OpenFileDialog.Description = "Выберите папку" $FolderBrowserDialog.Description = "Выберите папку"
} }
else else
{ {
$OpenFileDialog.Description = "Select a folder" $FolderBrowserDialog.Description = "Select a folder"
} }
$OpenFileDialog.RootFolder = "MyComputer" $FolderBrowserDialog.RootFolder = "MyComputer"
# Focus on open file dialog # Focus on open file dialog
# Перевести фокус на диалог открытия файла # Перевести фокус на диалог открытия файла
$tmp = New-Object -TypeName System.Windows.Forms.Form -Property @{TopMost = $true} $tmp = New-Object -TypeName System.Windows.Forms.Form -Property @{TopMost = $true}
$OpenFileDialog.ShowDialog($tmp) $FolderBrowserDialog.ShowDialog($tmp)
if ($OpenFileDialog.SelectedPath) if ($FolderBrowserDialog.SelectedPath)
{ {
Add-MpPreference -ExclusionPath $OpenFileDialog.SelectedPath -Force Add-MpPreference -ExclusionPath $FolderBrowserDialog.SelectedPath -Force
} }
$Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice) $Host.UI.PromptForChoice($Title, $Message, $Options, $DefaultChoice)
} }
@ -2614,13 +2908,13 @@ switch ($Result)
# Добавить файл в список исключений сканирования Microsoft Defender # Добавить файл в список исключений сканирования Microsoft Defender
if ($RU) if ($RU)
{ {
$Title = "Microsoft Defender" $Title = "Windows Defender"
$Message = "Чтобы исключить файл из списка сканирования антивредоносной программы Microsoft Defender, введите необходимую букву" $Message = "Чтобы исключить файл из списка сканирования антивредоносной программы Microsoft Defender, введите необходимую букву"
$Options = "&Исключить файл", "&Пропустить" $Options = "&Исключить файл", "&Пропустить"
} }
else else
{ {
$Title = "Microsoft Defender" $Title = "Windows Defender"
$Message = "To exclude file from Microsoft Defender Antivirus Scan enter the required letter" $Message = "To exclude file from Microsoft Defender Antivirus Scan enter the required letter"
$Options = "&Exclude file", "&Skip" $Options = "&Exclude file", "&Skip"
} }
@ -2735,23 +3029,20 @@ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -
#endregion Windows Defender & Security #endregion Windows Defender & Security
#region Context menu #region Context menu
# Add "Extract" item to Windows Installer (.msi) context menu # Add the "Extract" item to Windows Installer (.msi) context menu
# Добавить пункт "Извлечь" в контекстное меню Windows Installer (.msi) # Добавить пункт "Извлечь" в контекстное меню Windows Installer (.msi)
if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command)) if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command))
{ {
New-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Force New-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Force
} }
$Value = "{0}" -f 'msiexec.exe /a "%1" /qb TARGETDIR="%1 extracted"' $Value = "{0}" -f 'msiexec.exe /a "%1" /qb TARGETDIR="%1 extracted"'
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Name "(default)" -PropertyType String -Value $Value -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Name "(Default)" -PropertyType String -Value $Value -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name MUIVerb -PropertyType String -Value "@shell32.dll,-31382" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name MUIVerb -PropertyType String -Value "@shell32.dll,-31382" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name Icon -PropertyType String -Value "shell32.dll,-16817" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name Icon -PropertyType String -Value "shell32.dll,-16817" -Force
# Add "Run as different user" item to the .exe files types context menu # Add the "Run as different user" item to the .exe files types context menu
# Добавить "Запуск от имени другого пользователя" в контекстное меню .exe файлов # Добавить "Запуск от имени другого пользователя" в контекстное меню .exe файлов
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\exefile\shell\runasuser -Name "(default)" -PropertyType String -Value "@shell32.dll,-50944" -Force
Remove-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\exefile\shell\runasuser -Name Extended -Force -ErrorAction Ignore Remove-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\exefile\shell\runasuser -Name Extended -Force -ErrorAction Ignore
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\exefile\shell\runasuser -Name SuppressionPolicyEx -PropertyType String -Value "{F211AA05-D4DF-4370-A2A0-9F19C09756A7}" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\exefile\shell\runasuser\command -Name DelegateExecute -PropertyType String -Value "{ea72d00e-4960-42fa-ba92-7792a7944c1d}" -Force
# Add the "Install" item to the .cab archives context menu # Add the "Install" item to the .cab archives context menu
# Добавить пункт "Установить" в контекстное меню .cab архивов # Добавить пункт "Установить" в контекстное меню .cab архивов
@ -2760,11 +3051,11 @@ if (-not (Test-Path -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs\Comm
New-Item -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs\Command -Force New-Item -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs\Command -Force
} }
$Value = "{0}" -f 'cmd /c DISM.exe /Online /Add-Package /PackagePath:"%1" /NoRestart & pause' $Value = "{0}" -f 'cmd /c DISM.exe /Online /Add-Package /PackagePath:"%1" /NoRestart & pause'
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs\Command -Name "(default)" -PropertyType String -Value $Value -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs\Command -Name "(Default)" -PropertyType String -Value $Value -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Name MUIVerb -PropertyType String -Value "@shell32.dll,-10210" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Name MUIVerb -PropertyType String -Value "@shell32.dll,-10210" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Name HasLUAShield -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Name HasLUAShield -PropertyType String -Value "" -Force
# Hide "Cast to Device" item from the context menu # Hide the "Cast to Device" item from the context menu
# Скрыть пункт "Передать на устройство" из контекстного меню # Скрыть пункт "Передать на устройство" из контекстного меню
if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked")) if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{ {
@ -2772,7 +3063,7 @@ if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
} }
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{7AD84985-87B4-4a16-BE58-8B72A5B390F7}" -PropertyType String -Value "Play to menu" -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{7AD84985-87B4-4a16-BE58-8B72A5B390F7}" -PropertyType String -Value "Play to menu" -Force
# Hide "Share" item from the context menu # Hide the "Share" item from the context menu
# Скрыть пункт "Отправить" (поделиться) из контекстного меню # Скрыть пункт "Отправить" (поделиться) из контекстного меню
if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked")) if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{ {
@ -2780,7 +3071,7 @@ if (-not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell
} }
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{E2BF9676-5F8F-435C-97EB-11607A5BEDF7}" -PropertyType String -Value "" -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{E2BF9676-5F8F-435C-97EB-11607A5BEDF7}" -PropertyType String -Value "" -Force
# Hide "Edit with Paint 3D" item from the context menu # Hide the "Edit with Paint 3D" item from the context menu
# Скрыть пункт "Изменить с помощью Paint 3D" из контекстного меню # Скрыть пункт "Изменить с помощью Paint 3D" из контекстного меню
$extensions = @(".bmp", ".gif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff") $extensions = @(".bmp", ".gif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff")
foreach ($extension in $extensions) foreach ($extension in $extensions)
@ -2788,12 +3079,12 @@ foreach ($extension in $extensions)
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\$extension\Shell\3D Edit" -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\$extension\Shell\3D Edit" -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
} }
# Hide "Include in Library" item from the context menu # Hide the "Include in Library" item from the context menu
# Скрыть пункт "Добавить в библиотеку" из контекстного меню # Скрыть пункт "Добавить в библиотеку" из контекстного меню
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\Library Location" -Name "(default)" -PropertyType String -Value "-{3dad6c5d-2167-4cae-9914-f99e41c12cfa}" -Force New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\Library Location" -Name "(Default)" -PropertyType String -Value "-{3dad6c5d-2167-4cae-9914-f99e41c12cfa}" -Force
# Remove "Turn on BitLocker" item from the context menu # Hide the "Turn on BitLocker" item from the context menu
# Удалить пункт "Включить BitLocker" из контекстного меню # Скрыть пункт "Включить BitLocker" из контекстного меню
if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -eq "Professional" -or $_.Edition -eq "Enterprise"}) if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -eq "Professional" -or $_.Edition -eq "Enterprise"})
{ {
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\encrypt-bde -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\encrypt-bde -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
@ -2804,44 +3095,44 @@ if (Get-WindowsEdition -Online | Where-Object -FilterScript {$_.Edition -eq "Pro
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\unlock-bde -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\unlock-bde -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
} }
# Remove "Edit with Photos" item from the context menu # Hide the "Edit with Photos" item from the context menu
# Удалить пункт "Изменить с помощью приложения "Фотографии"" из контекстного меню # Скрыть пункт "Изменить с помощью приложения "Фотографии"" из контекстного меню
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellEdit -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
# Remove "Create a new video" item from the context menu # Hide the "Create a new video" item from the context menu
# Удалить пункт "Создать новое видео" из контекстного меню # Скрыть пункт "Создать новое видео" из контекстного меню
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellCreateVideo -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc\Shell\ShellCreateVideo -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
# Remove "Bitmap image" item from the "New" context menu # Remove "Bitmap image" item from the "New" context menu
# Удалить пункт "Точечный рисунок" из контекстного меню "Создать" # Удалить пункт "Точечный рисунок" из контекстного меню "Создать"
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp\ShellNew -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp\ShellNew -Force -ErrorAction Ignore
# Hide "Edit" item from the images context menu # Remove the "Compressed (zipped) Folder" item from the "New" context menu
# Удалить пункт "Сжатая ZIP-папка" из контекстного меню "Создать"
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.zip\CompressedFolder\ShellNew -Force -ErrorAction Ignore
# Hide the "Edit" item from the images context menu
# Скрыть пункт "Изменить" из контекстного меню изображений # Скрыть пункт "Изменить" из контекстного меню изображений
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\edit -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\edit -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
# Remove "Print" item from the .bat and .cmd context menu # Hide the "Print" item from the .bat and .cmd context menu
# Удалить пункт "Печать" из контекстного меню .bat и .cmd файлов # Скрыть пункт "Печать" из контекстного меню .bat и .cmd файлов
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\batfile\shell\print -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\batfile\shell\print -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\cmdfile\shell\print -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\cmdfile\shell\print -Name ProgrammaticAccessOnly -PropertyType String -Value "" -Force
# Remove "Compressed (zipped) Folder" from the "New" context menu # Remove the "Rich Text Document" item from the "New" context menu
# Удалить пункт "Сжатая ZIP-папка" из контекстного меню "Создать"
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.zip\CompressedFolder\ShellNew -Force -ErrorAction Ignore
# Remove "Rich Text Document" from the "New" context menu
# Удалить пункт "Документ в формате RTF" из контекстного меню "Создать" # Удалить пункт "Документ в формате RTF" из контекстного меню "Создать"
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.rtf\ShellNew -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.rtf\ShellNew -Force -ErrorAction Ignore
# Hide "Send to" item from the folders context menu # Hide the "Send to" item from the folders context menu
# Скрыть пункт "Отправить" из контекстного меню папок # Скрыть пункт "Отправить" из контекстного меню папок
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo -Name "(default)" -PropertyType String -Value "" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\SendTo -Name "(Default)" -PropertyType String -Value "-{7BA4C740-9E81-11CF-99D3-00AA004AE837}" -Force
# Make the "Open", "Print", "Edit" context menu items available, when more than 15 items selected # Make the "Open", "Print", "Edit" context menu items available, when more than 15 items selected
# Сделать доступными элементы контекстного меню "Открыть", "Изменить" и "Печать" при выделении более 15 элементов # Сделать доступными элементы контекстного меню "Открыть", "Изменить" и "Печать" при выделении более 15 элементов
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name MultipleInvokePromptMinimum -PropertyType DWord -Value 300 -Force New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name MultipleInvokePromptMinimum -PropertyType DWord -Value 300 -Force
# Hide "Look for an app in the Microsoft Store" item in "Open with" dialog # Hide the "Look for an app in the Microsoft Store" item in "Open with" dialog
# Скрыть пункт "Поиск приложения в Microsoft Store" в диалоге "Открыть с помощью" # Скрыть пункт "Поиск приложения в Microsoft Store" в диалоге "Открыть с помощью"
if (-not (Test-Path -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer)) if (-not (Test-Path -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer))
{ {
@ -2849,7 +3140,7 @@ if (-not (Test-Path -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer))
} }
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoUseStoreOpenWith -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoUseStoreOpenWith -PropertyType DWord -Value 1 -Force
# Hide "Previous Versions" tab from files and folders context menu and "Restore previous versions" context menu item # Hide the "Previous Versions" tab from files and folders context menu and the "Restore previous versions" context menu item
# Скрыть вкладку "Предыдущие версии" в свойствах файлов и папок и пункт контекстного меню "Восстановить прежнюю версию" # Скрыть вкладку "Предыдущие версии" в свойствах файлов и папок и пункт контекстного меню "Восстановить прежнюю версию"
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name NoPreviousVersionsPage -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name NoPreviousVersionsPage -PropertyType DWord -Value 1 -Force
#endregion Context menu #endregion Context menu

Loading…
Cancel
Save