Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Операционные системы » Microsoft Windows » Быстрая настройка Windows (рабочее место)

Модерирует : KLASS, IFkO

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

farag



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору


Код:
 
# Службы диагностического отслеживания
$services = @(
"CDPSvc",
"DiagTrack",
"diagnosticshub.standardcollector.service",
"dmwappushservice",
"DusmSvc",
"lfsvc",
"MapsBroker",
"NcbService",
"SSDPSRV",
"tiledatamodelsvc",
"wcncsvc")
Foreach ($service In $services)
{
    Get-Service $service | Stop-Service -ErrorAction SilentlyContinue
    Get-Service $service | Set-Service -StartupType Disabled -ErrorAction SilentlyContinue
}
Remove-Variable services
# Отключение телеметрии и сбора данных для отправки
Set-AutologgerConfig -Name "AutoLogger-Diagtrack-Listener" -Start 0
Remove-Item $env:ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl -Force -ErrorAction SilentlyContinue
Set-AutologgerConfig -Name "SQMLogger" -Start 0
Remove-Item $env:SystemRoot\System32\LogFiles\SQM\SQMLogger.etl -Force -ErrorAction SilentlyContinue
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection -Name AllowTelemetry -Value 0 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\SQMClient\Windows))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\SQMClient\Windows -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\SQMClient\Windows -Name CEIPEnable -Value 0 -Force
IF (!(Test-Path HKLM:\SYSTEM\ControlSet001\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener))
{
    New-Item -Path HKLM:\SYSTEM\ControlSet001\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener -Force
}
New-ItemProperty -Path HKLM:\SYSTEM\ControlSet001\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener -Name Start -Value 0 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat -Name AITEnable -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat -Name DisableUAR -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppCompat -Name DisableInventory -Value 1 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name DoNotShowFeedbackNotifications -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Value 0 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\PerfTrack))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\PerfTrack -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\PerfTrack -Name Disabled -Value 0 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Name Disabled -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Name DisableAutomaticTelemetryKeywordReporting -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack -Name TelemetryServiceDisabled -Value 1 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack\TestHooks))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack\TestHooks -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Diagnostics\DiagTrack\TestHooks -Name DisableAsimovUpload -Value 0 -Force
IF (!(Test-Path HKLM:\SYSTEM\ControlSet001\Services\DiagTrack))
{
    New-Item -Path HKLM:\SYSTEM\ControlSet001\Services\DiagTrack -Force
}
New-ItemProperty -Path HKLM:\SYSTEM\ControlSet001\Services\DiagTrack -Name Start -Value 4 -Force
# Отключение дополнительной телеметрии и Steps-Recorder
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Compatibility-Assistant -Force
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Compatibility-Troubleshooter -Force
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Inventory -Force
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Telemetry -Force
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Steps-Recorder -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Compatibility-Assistant -Name Enabled -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Compatibility-Troubleshooter -Name Enabled -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Inventory -Name Enabled -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Program-Telemetry -Name Enabled -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-Application-Experience\Steps-Recorder -Name Enabled -Value 0 -Force
# Отключение и сброс собранной информации для предоставления рекламы
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Value 0 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Value 0 -Force
# Отключить отправку отчетов об ошибках
IF (!(Test-Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Windows Error Reporting" -Name Disabled -Value 1 -Force
# Изменение частоты формирования отзывов на "Никогда"
IF (!(Test-Path HKCU:\Software\Microsoft\Siuf\Rules))
{
    New-Item -Path HKCU:\Software\Microsoft\Siuf\Rules -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Siuf\Rules -Name NumberOfSIUFInPeriod -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Siuf\Rules -Name PeriodInNanoSeconds -Value 0 -Force
# Выключение Cortana
IF (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"))
{
    New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name AllowCortana -Value 0 -Force
# Отключить Контроль Wi-Fi
IF (Get-NetAdapter -Physical | Where-Object {$_.Name -Match "Беспроводная" -or $_.Name -match "Wi-Fi"})
{
    IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config))
    {
        New-Item -Path HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config -Force
    }
    New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config -Name AutoConnectAllowedOEM -Value 0 -Force
}
# Задачи диагностического отслеживания
Get-ScheduledTask appuriverifierdaily,
appuriverifierinstall,
BackupTask,
"Automatic App Update",
CleanupOfflineContent,
Consolidator,
CreateObjectTask,
DmClient,
DmClientOnScenarioDownload,
dusmtask,
"EDP Policy Manager",
FamilySafetyMonitor,
FamilySafetyMonitorToastTask,
FamilySafetyRefreshTask,
"File History (maintenance mode)",
GatherNetworkInfo,
MapsToastTask,
MapsUpdateTask,
"Microsoft Compatibility Appraiser",
Microsoft-Windows-DiskDiagnosticDataCollector,
"MNO Metadata Parser",
NetworkStateChangeTask,
ProgramDataUpdater,
Proxy,
QueueReporting,
SilentCleanup,
SpeechModelDownloadTask,
StartupAppTask,
TempSignedLicenseExchange,
UninstallSMB1ClientTask,
UninstallSMB1ServerTask,
UsbCeip,
WinSAT,
XblGameSaveTask | Disable-ScheduledTask
# Отключение в "Журналах Windows/Безопасность" сообщения "Платформа фильтрации IP-пакетов Windows разрешила подключение"
auditpol /set /subcategory:"{0CCE9226-69AE-11D9-BED3-505054503030}" /success:disable /failure:disable
# Удаление пункта "Закрепить на Начальном экране" из контекстного меню
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\PintoStartScreen -Force -ErrorAction SilentlyContinue
# Удаление пункта "Закрепить на Начальном экране" из контекстного меню для .exe-файлов
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\exefile\shellex\ContextMenuHandlers\PintoStartScreen -Force -ErrorAction SilentlyContinue
# Удаление пункта "pintohome" из контекстного меню Корзины
Remove-Item -Path HKLM:\SOFTWARE\Classes\Folder\shell\pintohome -ErrorAction SilentlyContinue -Recurse -Force
# Открывать "Этот компьютер" в Проводнике
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1 -Force
# Отобразить "Этот компьютер" на Рабочем столе
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel -Name "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value 0 -Force
# Показывать скрытые файлы
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name Hidden -Value 1 -Force
# Показывать расширения файлов
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideFileExt -Value 0 -Force
# Выключение гибернации
IF (!(Test-Path HKLM:\SYSTEM\CurrentControlSet\Control\Power))
{
    New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Control\Power -Force
}
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\Power -Name HibernateEnabled -Value 0 -Force
# Не показывать кнопку Просмотра задач
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowTaskViewButton -Value 0 -Force
# Не показывать кнопку поиска
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Search -Name SearchboxTaskbarMode -Value 0 -Force
# Подтверждение удаления файлов
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name ConfirmFileDelete -Value 1 -Force
# Развернуть ленту Проводника
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name ExplorerRibbonStartsMinimized -Value 2 -Force
# Развернуть диалог переноса файлов
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\OperationStatusManager -Name EnthusiastMode -Value 1 -Force
# Не скрывать конфликт слияния папок
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name HideMergeConflicts -Value 0 -Force
# Выключение автозапуска с внешних носителей
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers -Name DisableAutoplay -Value 1 -Force
# Отключение UAC. Необходимо в параметрах контроля учетных записей нажать OK и перезагрузиться
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Force
}
IF ((Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System).EnableLUA -ne 0)
{
    New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLUA -Value 0 -Force
}
# He дoбaвлять "- яpлык" для coздaвaeмыx яpлыкoв
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name link -Type Binary -Value ([byte[]](00,00,00,00)) -Force
# Отключение поиска программ в Microsoft Store
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoUseStoreOpenWith -Value 1 -Force
# Отключение проверки подписи для загруженных файлов
IF (!(Test-Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments))
{
    New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments -Force
}
New-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments -Name SaveZoneInformation -Value 1 -Force
# Отключение SmartScreen для приложений и файлов
IF (!(Test-Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer -Force
}
New-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name SmartScreenEnabled -Type String -Value Off -Force
# Отключение SmartScreen в IE
IF (!(Test-Path "HKCU:\Software\Microsoft\Internet Explorer\PhishingFilter"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Internet Explorer\PhishingFilter" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Internet Explorer\PhishingFilter" -Name EnabledV9 -Value 0 -Force
# Отключение SmartScreen в Edge
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName
IF (!(Test-Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter"))
{
    New-Item -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Force
}
New-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\PhishingFilter" -Name EnabledV9 -Value 0 -Force
Remove-Variable edge
# Не показывать при прикреплении окна, что можно прикрепить рядом с ним
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name SnapAssist -Value 0 -Force
# Запрет Windows управлять принтером по умолчанию
IF (!(Test-Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows" -Name LegacyDefaultPrinterMode -Value 1 -Force
# Сохранение скриншотов по Win+PrtScr на Рабочем столе
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{b7bede81-df94-4682-a7d8-57a52620b86f}"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{b7bede81-df94-4682-a7d8-57a52620b86f}" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{b7bede81-df94-4682-a7d8-57a52620b86f}" -Name RelativePath -Type String -Value %USERPROFILE%\Desktop -Force
# Установка качества фона рабочего стола на 100 %
IF (!(Test-Path "HKCU:\Control Panel\Desktop"))
{
    New-Item -Path "HKCU:\Control Panel\Desktop" -Force
}
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name JPEGImportQuality -Value 100 -Force
# Отключение залипания клавиши Shift после 5 нажатий
IF (!(Test-Path "HKCU:\Control Panel\Accessibility\StickyKeys"))
{
    New-Item -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Force
}
New-ItemProperty -Path "HKCU:\Control Panel\Accessibility\StickyKeys" -Name Flags -Type String -Value 506 -Force
# Отключение отображения вкладки "Предыдущие версии" в свойствах файлов
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name NoPreviousVersionsPage -Value 1 -Force
# Отключить флажки для выбора элементов
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name AutoCheckSelect -Value 0 -Force
# Изменение пути переменных сред для временных файлов
IF (!(Test-Path $env:SystemDrive\Temp))
{
    New-Item -Path $env:SystemDrive\Temp -Type Directory -Force
}
[Environment]::SetEnvironmentVariable("TMP","$env:SystemDrive\Temp","User")
[Environment]::SetEnvironmentVariable("TEMP","$env:SystemDrive\Temp","User")
[Environment]::SetEnvironmentVariable("TMP","$env:SystemDrive\Temp","Machine")
[Environment]::SetEnvironmentVariable("TEMP","$env:SystemDrive\Temp","Machine")
# Удаление UWP-приложений
Get-AppxPackage -AllUsers | Where-Object name -CNotLike *Store* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -CNotLike *Store* | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
# Отключение компонентов
$features = @(
# Отключение службы "Факсы и сканирование"
'FaxServicesClientPackage',
# Отключение компонентов прежних версий
'LegacyComponents',
# Отключение компонентов работы с мультимедиа
'MediaPlayback',
# Отключение PowerShell 2.0
'MicrosoftWindowsPowerShellV2',
'MicrosoftWindowsPowershellV2Root',
# Отключение службы XPS
'Printing-XPSServices-Features',
# Отключение и удаление поддержки протокола SMB1 на клиенте
# 'SMB1Protocol',
# Отключение службы "Клиент рабочих папок"
'WorkFolders-Client',
# Отключение просмотрщика XPS
'Xps-Foundation-Xps-Viewer')
Foreach ($feature in $features)
{
    Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
}
Remove-Variable features
# Добавить Средство просмотра фотографий Windows в пункт контекстного меню "Открыть с помощью"
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open -Name MuiVerb -Type String -Value "@photoviewer.dll,-3043" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
# Ассоциация со Средством просмотра фотографий Windows
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.bmp))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.bmp\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.bmp -Name "(Default)" -Type String -Value Paint.Picture -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.bmp -Name "Content Type" -Type String -Value image/bmp -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.bmp -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.bmp\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.bmp))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.bmp -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.bmp\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.bmp\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.bmp\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.bmp\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.bmp -Name "(Default)" -Type String -Value Paint.Picture -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.bmp -Name "Content Type" -Type String -Value image/bmp -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.bmp -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.bmp -Name Paint.Picture -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.bmp -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap -Name ImageOptionFlags -Value 1 -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap -Name FriendlyTypeName -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3056" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\DefaultIcon))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\DefaultIcon -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\DefaultIcon -Name "(Default)" -Type String -Value "%SystemRoot%\System32\imageres.dll,-70" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\command))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\command -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Bitmap\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithProgids -Name Paint.Picture -Type None -Value ([byte[]]::new(0)) -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.jpeg))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.jpeg -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.jpeg\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.jpeg\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpeg -Name "(Default)" -Type String -Value jpegfile -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpeg -Name "Content Type" -Type String -Value image/jpeg -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpeg -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpeg\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpeg))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpeg -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpeg\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpeg\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpeg\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpeg\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpeg -Name "(Default)" -Type String -Value jpegfile -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpeg -Name "Content Type" -Type String -Value image/jpeg -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpeg -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpeg -Name jpegfile -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpeg -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg -Name EditFlags -Value 1 -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg -Name ImageOptionFlags -Value 1 -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg -Name FriendlyTypeName -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3055" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\DefaultIcon))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\DefaultIcon -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\DefaultIcon -Name "(Default)" -Type String -Value "%SystemRoot%\System32\imageres.dll,-72" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\command))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\command -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open -Name MuiVerb -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Jpeg\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\OpenWithProgids -Name jpegfile -Type None -Value ([byte[]]::new(0)) -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\OpenWithProgids -Name jpegfile -Type None -Value ([byte[]]::new(0)) -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.jpg))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.jpg -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.jpg\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.jpg\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpg -Name "(Default)" -Type String -Value jpegfile -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpg -Name "Content Type" -Type String -Value image/jpeg -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpg -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.jpg\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpg))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpg -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpg\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpg\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.jpg\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.jpg\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpg -Name "(Default)" -Type String -Value jpegfile -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpg -Name "Content Type" -Type String -Value image/jpeg -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpg -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpg -Name jpegfile -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.jpg -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.png))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.png -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.png\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.png\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.png -Name "(Default)" -Type String -Value pngfile -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.png -Name "Content Type" -Type String -Value image/png -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.png -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.png\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.png))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.png -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.png\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.png\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.png\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.png\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.png -Name "(Default)" -Type String -Value pngfile -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.png -Name "Content Type" -Type String -Value image/png -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.png -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.png -Name pngfile -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.png -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\DefaultIcon))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\DefaultIcon -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\DefaultIcon -Name "(Default)" -Type String -Value "%SystemRoot%\System32\imageres.dll,-71" -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\command))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\command -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\DropTarget))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\DropTarget -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png -Name ImageOptionFlags -Value 1 -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png -Name FriendlyTypeName -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll,-3057" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\PhotoViewer.FileAssoc.Png\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithProgids -Name jpegfile -Type None -Value ([byte[]]::new(0)) -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.tif))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.tif -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.tif\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.tif\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tif -Name "(Default)" -Type String -Value TIFImage.Document -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tif -Name "Content Type" -Type String -Value image/tiff -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tif -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tif\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tif))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tif -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tiff\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tif\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tif\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tif\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tif -Name "(Default)" -Type String -Value TIFImage.Document -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tif -Name "Content Type" -Type String -Value image/tif -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tif -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tif -Name TIFImage.Document -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tif -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\OpenWithProgids -Name TIFImage.Document -Type None -Value ([byte[]]::new(0)) -Force
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.tiff))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.tiff -Force
}
IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\.tiff\PersistentHandler))
{
    New-Item -Path Registry::HKEY_CLASSES_ROOT\.tiff\PersistentHandler -Force
}
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tiff -Name "(Default)" -Type String -Value TIFImage.Document -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tiff -Name "Content Type" -Type String -Value image/tiff -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tiff -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\.tiff\PersistentHandler -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tiff))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tiff -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tiff\OpenWithProgids))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tiff\OpenWithProgids -Force
}
IF (!(Test-Path HKLM:\SOFTWARE\Classes\.tiff\PersistentHandler))
{
    New-Item -Path HKLM:\SOFTWARE\Classes\.tiff\PersistentHandler -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tiff -Name "(Default)" -Type String -Value TIFImage.Document -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tiff -Name "Content Type" -Type String -Value image/tiff -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tiff -Name PerceivedType -Type String -Value image -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tiff -Name TIFImage.Document -Type String -Value "" -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Classes\.tiff -Name "(Default)" -Type String -Value "{098f2470-bae0-11cd-b579-08002b30bfeb}" -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff -Force
}
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList -Name a -Type String -Value PhotoViewer.dll -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithList -Name MRUList -Type String -Value a -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithProgids))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithProgids -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\OpenWithProgids -Name TIFImage.Document -Type None -Value ([byte[]]::new(0)) -Force
Foreach ($type in @("Paint.Picture", "jpegfile", "pngfile"))
{
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\$type\shell\open))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\$type\shell\open -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\$type\shell\open\command))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\$type\shell\open\command -Force
    }
    New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\$type\shell\open" -Name MuiVerb -Type ExpandString -Value "@%ProgramFiles%\Windows Photo Viewer\photoviewer.dll,-3043" -Force
    New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\$type\shell\open\command" -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
}
IF (!(Test-Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache"))
{
    New-Item -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" -Force
}
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" -Name "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll.FriendlyAppName" -Type String -Value "Просмотр фотографий Windows" -Force
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache" -Name "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll.ApplicationCompany" -Type String -Value "Microsoft Corporation" -Force
$sid = (Get-CimInstance Win32_UserAccount -Filter "name='$env:USERNAME'").SID
$task = @"
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice [1 6 9 17]
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice [1 6 9 17]
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice [1 6 9 17]
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice [1 6 9 17]
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice [1 6 9 17]
\Registry\user\$sid\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice [1 6 9 17]
"@
Add-Content $env:SystemDrive\registry.txt $task -Force
regini.exe $env:SystemDrive\registry.txt
Remove-Item $env:SystemDrive\registry.txt -Force
Remove-Variable sid, task
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Bitmap -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpg\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Jpeg -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.jpeg\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Jpeg -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Png -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tiff\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Tiff -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.tif\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Tiff -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Bitmap_.bmp -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Jpeg_.jpeg -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Jpeg_.jpg -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Png_.png -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Tiff_.tiff -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PhotoViewer.FileAssoc.Tiff_.tif -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.jpg -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.jpeg -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.png -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.bmp -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.tiff -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.tif -Value 0 -Force
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" -Name ApplicationDescription -Type String -Value "@%ProgramFiles%\\Windows Photo Viewer\\photoviewer.dll,-3069" -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities" -Name ApplicationName -Type String -Value "@%ProgramFiles%\\Windows Photo Viewer\\photoviewer.dll,-3009" -Force
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .bmp -Type String -Value PhotoViewer.FileAssoc.Bitmap -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .jpg -Type String -Value PhotoViewer.FileAssoc.Jpeg -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .jpeg -Type String -Value PhotoViewer.FileAssoc.Jpeg -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .png -Type String -Value PhotoViewer.FileAssoc.Png -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .tif -Type String -Value PhotoViewer.FileAssoc.Tiff -Force
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Photo Viewer\Capabilities\FileAssociations" -Name .tiff -Type String -Value PhotoViewer.FileAssoc.Tiff -Force
# Удаление OneDrive
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive
}
Stop-Process -Name OneDrive -ErrorAction SilentlyContinue
Start-Sleep -s 3
Start-Process $env:SystemRoot\SysWOW64\OneDriveSetup.exe /uninstall -NoNewWindow -Wait
Start-Sleep -s 3
Stop-Process -Name explorer -ErrorAction SilentlyContinue
Start-Sleep -s 3
Remove-Item "$env:USERPROFILE\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:LOCALAPPDATA\Microsoft\OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:ProgramData\Microsoft OneDrive" -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:SystemDrive\OneDriveTemp" -Force -Recurse -ErrorAction SilentlyContinue
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive -Name DisableFileSyncNGSC -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive -Name DisableFileSync -Value 1 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive -Name DisableMeteredNetworkFileSync -Value 0 -Force
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive -Name DisableLibrariesDefaultSaveToOneDrive -Value 1 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\OneDrive -Name DisablePersonalSync -Value 1 -Force
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\OneDrive.lnk" -Force -ErrorAction SilentlyContinue
Unregister-ScheduledTask onedrive* -Confirm:$false
Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Run -Name OneDrive -Force -ErrorAction SilentlyContinue
Remove-ItemProperty -Path HKCU:\Environment -Name OneDrive -Force -ErrorAction SilentlyContinue
# Выключение подсказок Windows
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SoftLandingEnabled -Value 0 -Force
# Включение автоматического обновления для других продуктов Microsoft
$update = New-Object -ComObject Microsoft.Update.ServiceManager
$update.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
Remove-Variable update
# Блокировка рекламы в Skype
$hostfile = "$env:SystemRoot\System32\drivers\etc\hosts"
$domains = @("apps.skype.com", "a.config.skype.com", "b.config.skype.com", "cdn.eyewonder.com", "g.msn.com", "pipe.skype.com", "rad.msn.com")
Foreach ($hostentry in $domains)  
{
    IF (!(Get-Content $hostfile | Select-String "0.0.0.0 `t $hostentry"))
    {
        Add-Content -path $hostfile -value "0.0.0.0 `t $hostentry"
    }
}
Remove-Variable hostfile, domains
# Отключение игровой панели
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\GameDVR -Name AppCaptureEnabled -Value 0 -Force
IF (!(Test-Path HKCU:\System\GameConfigStore))
{
    New-Item -Path HKCU:\System\GameConfigStore -Force
}
New-ItemProperty -Path HKCU:\System\GameConfigStore -Name GameDVR_Enabled -Value 0 -Force
# Отключение записи игр
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\GameDVR -Name AllowgameDVR -Value 0 -Force
# Отключение режима игры
IF (!(Test-Path HKCU:\Software\Microsoft\GameBar))
{
    New-Item -Path HKCU:\Software\Microsoft\GameBar -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\GameBar -Name AllowAutoGameMode -Value 0 -Force
# Выключение Восстановления системы
Disable-ComputerRestore -drive $env:SystemDrive
Get-CimInstance -ClassName Win32_shadowcopy | Remove-CimInstance
Get-ScheduledTask -TaskName SR | Disable-ScheduledTask
Get-Service swprv,vss | Stop-Service -ErrorAction SilentlyContinue
Get-Service swprv,vss | Set-Service -StartupType Disabled
# Выключение Windows Script Host
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Script Host\Settings" -Name Enabled -Value 0 -Force
# Всегда отображать все значки в области уведомлений
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name EnableAutoTray -Value 0 -Force
# Отключение брандмауэра
Set-NetFirewallProfile -Enabled false
# Отключение обновления из нескольких мест
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config -Name DODownloadMode -Value 0 -Force
# Включение в Планировщике задач запуска Очистки диска
IF (!(Test-Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches))
{
    New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches -Force
}
$basekey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches"
$keys = @(
"Delivery Optimization Files"
"Device Driver Packages"
"Downloaded Program Files"
"Offline Pages Files"
"Previous Installations"
"Recycle Bin"
"Service Pack Cleanup"
"Setup Log Files"
"System error memory dump files"
"System error minidump files"
"Temporary Setup Files"
"Update Cleanup"
"Windows Defender"
"Windows Error Reporting Files"
"Windows Upgrade Log Files")
Foreach ($key In $keys)
{
    New-ItemProperty -Path "$($BaseKey)\$($Key)" -Name StateFlags1227 -Value 2 -Force
}
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "Start-Process -Wait $env:SystemRoot\System32\cleanmgr.exe -WindowStyle Hidden /sagerun:1227"
$trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 60 -At 9am
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "Cleanmg"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable basekey, keys, action, trigger, settings, principal, params
# Включение в Планировщике задач очистки временной папки
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument 'Get-ChildItem -Path "$env:TEMP" -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue'
$trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 62 -At 9am
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "Temp"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable action, trigger, settings, principal, params
# Включение в Планировщике задач очистки папки %SYSTEMROOT%\SoftwareDistribution\Download
IF (!(Test-Path D:\Программы\Прочее))
{
    New-Item -Path D:\Программы\Прочее -Type Directory -Force
}
Foreach ($dir in @("E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее\SoftwareDistribution.xml)
    {
        Copy-Item $dir\Программы\Прочее\SoftwareDistribution.xml D:\Программы\Прочее -Force
        break
    }
}
Register-ScheduledTask -Xml (Get-Content "D:\Программы\Прочее\SoftwareDistribution.xml" | Out-String) -TaskName "SoftwareDistribution" -Force
<#
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "`$getservice = Get-Service -Name wuauserv; `$getservice.WaitForStatus('Stopped', '01:00:00'); Get-ChildItem -Path $env:SystemRoot\SoftwareDistribution\Download -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue"
$trigger = New-ScheduledTaskTrigger -Weekly -At 9am -DaysOfWeek Thursday -WeeksInterval 4
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "SoftwareDistribution"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable getservice, action, trigger, settings, principal, params
#>
# Включение в Планировщике задач удаление устаревших обновлений Office
IF (!(Test-Path D:\Программы\Прочее))
{
    New-Item -Path D:\Программы\Прочее -Type Directory -Force
}
Foreach ($dir in @("E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее\Office_task.bat)
    {
        Copy-Item $dir\Программы\Прочее\Office_task.bat D:\Программы\Прочее -Force
    }
    IF (Test-Path $dir\Программы\Прочее\Office.xml)
    {
        Copy-Item $dir\Программы\Прочее\Office.xml D:\Программы\Прочее -Force
        break
    }
}
Register-ScheduledTask -Xml (Get-Content "D:\Программы\Прочее\Office.xml" | Out-String) -TaskName "Office" -Force
<#
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "`$getservice = Get-Service -Name wuauserv; `$getservice.WaitForStatus('Stopped', '01:00:00'); Start-Process -FilePath D:\Программы\Прочее\Office_task.bat"
$trigger = New-ScheduledTaskTrigger -Weekly -At 9am -DaysOfWeek Thursday -WeeksInterval 4
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "Office"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable getservice, action, trigger, settings, principal, params
#>
# Включение в Планировщике задач очистки папки %SYSTEMROOT%\LiveKernelReports
IF (!(Test-Path D:\Программы\Прочее))
{
    New-Item -Path D:\Программы\Прочее -Type Directory -Force
}
Foreach ($dir in @("E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее\LiveKernelReports.xml)
    {
        Copy-Item $dir\Программы\Прочее\LiveKernelReports.xml D:\Программы\Прочее -Force
        break
    }
}
Register-ScheduledTask -Xml (Get-Content "D:\Программы\Прочее\LiveKernelReports.xml" | Out-String) -TaskName "LiveKernelReports" -Force
<#
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "`$dir = '$env:SystemRoot\LiveKernelReports'; `$foldersize = (Get-ChildItem -Path `$dir -Recurse | Measure-Object -Property Length -Sum).Sum/1MB; IF (`$foldersize -GT 100) {Get-ChildItem -Path `$dir -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue}"
$trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 62 -At 9am
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "LiveKernelReports"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable foldersize, action, trigger, settings, principal, params
#>
# Включение в Планировщике задач очистки папки %SYSTEMROOT%\Logs\CBS
IF (!(Test-Path D:\Программы\Прочее))
{
    New-Item -Path D:\Программы\Прочее -Type Directory -Force
}
Foreach ($dir in @("E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее\CBS.xml)
    {
        Copy-Item $dir\Программы\Прочее\CBS.xml D:\Программы\Прочее -Force
        break
    }
}
Register-ScheduledTask -Xml (Get-Content "D:\Программы\Прочее\CBS.xml" | Out-String) -TaskName "CBS" -Force
<#
$action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "`$dir = '$env:SystemRoot\Logs\CBS'; `$foldersize = (Get-ChildItem -Path `$dir -Recurse | Measure-Object -Property Length -Sum).Sum/1MB; IF (`$foldersize -GT 10) {Get-ChildItem -Path `$dir -Force -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue}"
$trigger = New-ScheduledTaskTrigger -Daily -DaysInterval 62 -At 9am
$settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$principal = New-ScheduledTaskPrincipal -UserID System -RunLevel Highest
$params = @{
"TaskName"    = "CBS"
"Action"    = $action
"Trigger"    = $trigger
"Settings"    = $settings
"Principal"    = $principal
}
Register-ScheduledTask @Params -Force
Remove-Variable foldersize, action, trigger, settings, principal, params
#>
# Домашняя страница в IE
IF (!(Test-Path "HKCU:\Software\Microsoft\Internet Explorer\Main"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Internet Explorer\Main" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Internet Explorer\Main" -Name "Start Page" -Type String -Value https://yandex.ru -Force
# Начинать с вкладок, открытых в предыдущем сеансе в IE
IF (!(Test-Path "HKCU:\Software\Microsoft\Internet Explorer\ContinuousBrowsing"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Internet Explorer\ContinuousBrowsing" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Internet Explorer\ContinuousBrowsing" -Name Enabled -Value 1 -Force
# Запрет приложениям работать в фоновом режиме
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications -Force
}
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$edge" -Name DisabledByUser -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$edge" -Name Disabled -Value 1 -Force
Remove-Variable edge
$store = (Get-AppxPackage -AllUsers "Microsoft.WindowsStore").PackageFamilyName
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$store" -Name DisabledByUser -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$store" -Name Disabled -Value 1 -Force
Remove-Variable store
$settings = (Get-AppxPackage -AllUsers "windows.immersivecontrolpanel").PackageFamilyName
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$settings" -Name DisabledByUser -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$settings" -Name Disabled -Value 1 -Force
Remove-Variable settings
$connect = (Get-AppxPackage -AllUsers "Microsoft.PPIProjection").PackageFamilyName
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$connect" -Name DisabledByUser -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications\$connect" -Name Disabled -Value 1 -Force
Remove-Variable connect
# Скрыть в IE кнопку, которая открывает Microsoft Edge
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Internet Explorer\Main" -Name HideNewEdgeButton -Value 1 -Force
# Удалить в IE пункт "Отзывы и предложения"
IF (!(Test-Path "HKCU:\Software\Policies\Microsoft\Internet Explorer\Restrictions"))
{
    New-Item -Path "HKCU:\Software\Policies\Microsoft\Internet Explorer\Restrictions" -Force
}
New-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Internet Explorer\Restrictions" -Name NoHelpItemSendFeedback -Value 1 -Force
<#
# Установить бронзовый курсор из Windows XP
Foreach ($dir in @("E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее\bronze.cur)
    {
        Copy-Item $dir\Программы\Прочее\bronze.cur "$env:SystemRoot\Cursors" -Force
    }
}
IF (!(Test-Path "HKCU:\Control Panel\Cursors"))
{
    New-Item -Path "HKCU:\Control Panel\Cursors"
}
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name Arrow -Type ExpandString -Value "%SystemRoot%\cursors\bronze.cur" -Force
$CSharpSig = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
"@
$CursorRefresh = Add-Type -MemberDefinition $CSharpSig -Name WinAPICall -Namespace SystemParamInfo –PassThru
$CursorRefresh::SystemParametersInfo(0x0057,0,$null,0)
Remove-Variable CSharpSig, CursorRefresh
#>
# Включить контроль памяти
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Name 01 -Value 1 -Force
# Удалять временные файлы, не используемые в приложениях
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Name 04 -Value 1 -Force
# Удалять файлы, которые находятся в корзине более 30 дней
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\StorageSense\Parameters\StoragePolicy -Name 08 -Value 1 -Force
# Отобразить секунды в системных часах на панели задач
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name ShowSecondsInSystemClock -Value 1 -Force
# Установить схему управления питания на "Высокая производительность"
powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
# Использовать последнюю установленную версию .NET Framework для всех приложений
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\.NETFramework))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\.NETFramework -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\.NETFramework -Name OnlyUseLatestCLR -Value 1 -Force
IF (!(Test-Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework))
{
    New-Item -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework -Name OnlyUseLatestCLR -Value 1 -Force
# Не отображать экран блокировки
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Value 1 -Force
# Использовать сценарий автоматической настройки прокси в IE
IF (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap" -Name ProxyByPass -Value 0 -Force
IF (!(Test-Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"))
{
    New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Type String -Value https://antizapret.prostovpn.org/proxy.pac -Force
# Включение Num Lock при загрузке
IF (!(Test-Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\Keyboard"))
{
    New-Item -Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\Keyboard" -Force
}
New-ItemProperty -Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\Keyboard" -Name InitialKeyboardIndicators -Type String -Value 2147483650 -Force
# Не показывать рекомендации в меню Пуск
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SubscribedContent-338388Enabled -Value 0 -Force
# Отключить автоматическую установку рекомендованных приложений
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SilentInstalledAppsEnabled -Value 0 -Force
# Выключение возможностей потребителя Microsoft
IF (!(Test-Path HKLM:\Software\Policies\Microsoft\Windows\CloudContent))
{
    New-Item -Path HKLM:\Software\Policies\Microsoft\Windows\CloudContent -Force
}
New-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\CloudContent -Name DisableWindowsConsumerFeatures -Value 1 -Force
# Добавить в исключение Windows Defender папку
Foreach ($dir in @("D:","E:","F:","G:"))
{
    IF (Test-Path $dir\Программы\Прочее)
    {
        Add-MpPreference -ExclusionPath $dir\Программы\Прочее -Force
    }
}
# Выключение справки по F1
IF ($ENV:PROCESSOR_ARCHITECTURE -match "AMD64" -eq "true")
{
    IF (!(Test-Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win64"))
    {
        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)" -Type String -Value "" -Force
    }
}
Else
{
    IF (!(Test-Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win32"))
    {
        New-Item -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win32" -Force
        New-ItemProperty -Path "HKCU:\Software\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}\1.0\0\win32" -Name "(Default)" -Type String -Value "" -Force
    }
}
# Раскрыть окно Диспетчера задач
$taskmgr = Get-Process Taskmgr -ErrorAction SilentlyContinue
IF ($taskmgr)
{
    $taskmgr.CloseMainWindow()
}
Start-Process -FilePath Taskmgr
Start-Sleep -s 1
$taskmgr = Get-Process Taskmgr
IF ($taskmgr)
{
    $taskmgr.CloseMainWindow()
}
Start-Sleep -s 1
$preferences = Get-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager -Name Preferences -ErrorAction SilentlyContinue
$preferences.Preferences[28] = 0
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\TaskManager -Name Preferences -Type Binary -Value $preferences.Preferences -Force
Start-Process -FilePath Taskmgr
Remove-Variable taskmgr, preferences
# Запрет отключения Ethernet-адаптера для экономии энергии
Foreach ($NIC in (Get-NetAdapter -Physical))
{
    $PowerSaving = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi | Where-Object {$_.InstanceName -match [Regex]::Escape($NIC.PnPDeviceID)}
    IF ($PowerSaving.Enable)
    {
        $PowerSaving.Enable = $false
        $PowerSaving | Set-CimInstance
    }
}
Remove-Variable PowerSaving
# Установка крупных значков в панели управления
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel -Name AllItemsIconView -Value 0 -Force
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel -Name StartupPage -Value 1 -Force
# Удаление пункта "Изменить с помощью Paint 3D" из контекстного меню
$exts = @(".bmp", ".gif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff")
Foreach ($ext in $exts)  
{
    Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\$ext\Shell\3D Edit" -Recurse -Force -ErrorAction SilentlyContinue  
}
Remove-Variable exts
# Удаление пункта "Передать на устройство" из контекстного меню
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{7AD84985-87B4-4a16-BE58-8B72A5B390F7}" -Type String -Value "Play to menu" -Force
# Удаление пункта "Отправить" из контекстного меню
Remove-Item -LiteralPath "Registry::HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\ModernSharing" -Recurse -Force -ErrorAction SilentlyContinue
# Всегда ждать сеть при запуске и входе в систему
IF (!(Test-Path "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon"))
{
    New-Item -Path "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Force
}
New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name SyncForegroundPolicy -Value 1 -Force
# Не показывать уведомление "Установлено новое приложение"
IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer))
{
    New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoNewAppAlert -Value 1 -Force
# Переопределение метода ввода на английский язык
IF (!(Test-Path "HKCU:\Control Panel\International\User Profile"))
{
    New-Item -Path "HKCU:\Control Panel\International\User Profile" -Force
}
New-ItemProperty -Path "HKCU:\Control Panel\International\User Profile" -Name InputMethodOverride -Type String -Value "0409:00000409" -Force
IF (!(Test-Path "HKCU:\Keyboard Layout\Preload"))
{
    New-Item -Path "HKCU:\Keyboard Layout\Preload" -Force
}
New-ItemProperty -Path "HKCU:\Keyboard Layout\Preload" -Name 1 -Type String -Value 00000409 -Force
New-ItemProperty -Path "HKCU:\Keyboard Layout\Preload" -Name 2 -Type String -Value 00000419 -Force
IF (!(Test-Path "HKCU:\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}"))
{
    New-Item -Path "HKCU:\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}" -Name KeyboardLayout -Value 67699721 -Force
IF (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Control Panel\International"))
{
    New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Control Panel\International" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Control Panel\International" -Name BlockUserInputMethodsForSignIn -Value 1 -Force
IF (!(Test-Path HKCU:\Software\Microsoft\Input\Locales))
{
    New-Item -Path HKCU:\Software\Microsoft\Input\Locales -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Input\Locales -Name InputLocale -Value 1115145 -Force
IF (!(Test-Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\International\User Profile"))
{
    New-Item -Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\International\User Profile" -Force
}
New-ItemProperty -Path "Registry::HKEY_USERS\.DEFAULT\Control Panel\International\User Profile" -Name InputMethodOverride -Type String -Value "0409:00000409" -Force
IF (!(Test-Path "Registry::HKEY_USERS\.DEFAULT\Keyboard Layout\Preload"))
{
    New-Item -Path "Registry::HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" -Force
}
New-ItemProperty -Path "Registry::HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" -Name 1 -Type String -Value 00000409 -Force
New-ItemProperty -Path "Registry::HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" -Name 2 -Type String -Value 00000419 -Force
IF (!(Test-Path "Registry::HKEY_USERS\.DEFAULT\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}"))
{
    New-Item -Path "Registry::HKEY_USERS\.DEFAULT\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}" -Force
}
New-ItemProperty -Path "Registry::HKEY_USERS\.DEFAULT\Software\Microsoft\CTF\Assemblies\0x00000409\{34745C63-B2F0-4784-8B67-5E12C8701A31}" -Name KeyboardLayout -Value 67699721 -Force
# Не отображать кнопку "Люди"
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People -Name PeopleBand -Value 0 -Force
# Не выполнять мастер запуска IE в первый раз
IF (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main"))
{
    New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Internet Explorer\Main" -Name DisableFirstRunCustomize -Value 1 -Force
# Скрыть папку "Объемные объекты" из Этот компьютер
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name ThisPCPolicy -Type String -Value Hide -Force
IF (!(Test-Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag"))
{
    New-Item -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name ThisPCPolicy -Type String -Value Hide -Force
# Включение широких кнопок в контекстном меню
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\FlightedFeatures))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\FlightedFeatures -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\FlightedFeatures -Name ImmersiveContextMenu -Value 1 -Force
# Не показывать анимацию при первом входе в систему
IF (!(Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System))
{
    New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableFirstLogonAnimation -Value 0 -Force
# Снятие ограничения на одновременное открытие более 15 элементов
IF (!(Test-Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name MultipleInvokePromptMinimum -Value 300 -Force
# Выключение Flash Player в Edge
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName
IF (!(Test-Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\Addons"))
{
    New-Item -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\Addons" -Force
}
New-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\Addons" -Name FlashPlayerEnabled -Value 0 -Force
Remove-Variable edge
# Открывать в новом окне предыдущие страницы в Edge
$edge = (Get-AppxPackage -AllUsers "Microsoft.MicrosoftEdge").PackageFamilyName
IF (!(Test-Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\ContinuousBrowsing"))
{
    New-Item -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\ContinuousBrowsing" -Force
}
New-ItemProperty -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppContainer\Storage\$edge\MicrosoftEdge\ContinuousBrowsing" -Name Enabled -Value 1 -Force
Remove-Variable edge
# Не показывать недавно используемые папки на панели быстрого доступа
IF (!(Test-Path Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Value 0 -Force
# Не показывать недавно использовавшиеся файлы на панели быстрого доступа
IF (!(Test-Path Software\Microsoft\Windows\CurrentVersion\Explorer))
{
    New-Item -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Value 0 -Force
# Удаление пункта "Добавить в библиотеку" из контекстного меню
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\Library Location" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKLM:\SOFTWARE\Classes\Folder\ShellEx\ContextMenuHandlers\Library Location" -Recurse -Force -ErrorAction SilentlyContinue
# Удаление пункта "Предоставить доступ к" из контекстного меню
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{f81e9010-6ea4-11ce-a7ff-00aa003ca9f6}" -Type String -Value "" -Force
# Удаление пункта "Включить Bitlocker" из контекстного меню
$keys = @(
"encrypt-bde",
"encrypt-bde-elev",
"manage-bde",
"resume-bde",
"resume-bde-elev",
"unlock-bde")
Foreach ($key In $keys)
{
    IF(!(Test-Path Registry::HKEY_CLASSES_ROOT\Drive\shell\$key))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\$key -Force
    }
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Drive\shell\$key -Name ProgrammaticAccessOnly -Type String -Value "" -Force
 
}
Remove-Variable keys
# Удаление из автозагрузки иконки Защитника Windows
Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run -Name SecurityHealth -Force -ErrorAction SilentlyContinue
# Открепить от панели задач Microsoft Edge и Microsoft Store
$getstring = @'
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
internal static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
public static string GetString(uint strId)
{
    IntPtr intPtr = GetModuleHandle("shell32.dll");
    StringBuilder sb = new StringBuilder(255);
    LoadString(intPtr, strId, sb, sb.Capacity);
    return sb.ToString();
}
'@
$getstring = Add-Type $getstring -PassThru -Name GetStr -Using System.Text
$unpinFromStart = $getstring[0]::GetString(5387)
$apps = (New-Object -Com Shell.Application).NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}").Items()
$apps | Where-Object { $_.Path -like "Microsoft.MicrosoftEdge*"} | ForEach-Object {$_.Verbs() | Where-Object {$_.Name -eq $unpinFromStart} | ForEach-Object {$_.DoIt()}}
$apps | Where-Object { $_.Path -like "Microsoft.WindowsStore*"} | ForEach-Object {$_.Verbs() | Where-Object {$_.Name -eq $unpinFromStart} | ForEach-Object {$_.DoIt()}}
Remove-Variable getstring, unpinFromStart, apps
# Добавить пункт "Извлечь" для MSI в контекстное меню
IF (!(Test-Path -Path "Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Извлечь\Command"))
{
    New-Item -Path "Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Извлечь\Command" -Force
}
New-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Извлечь\Command" -Name "(Default)" -Type String -Value 'msiexec.exe /a "%1" /qb TARGETDIR="%1 extracted"' -Force
# Не использовать мои данные для входа для автоматического завершения настройки устройства после перезапуска или обновления
$sid = (Get-CimInstance Win32_UserAccount -Filter "name='$env:USERNAME'").SID
IF (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserARSO\$sid"))
{
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserARSO\$sid" -Force
}
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserARSO\$sid" -Name OptOut -Value 1 -Force
Remove-Variable sid
 
Stop-Process -ProcessName explorer
 


Всего записей: 2476 | Зарегистр. 27-07-2009 | Отправлено: 20:51 12-12-2017 | Исправлено: farag, 21:08 12-12-2017
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Операционные системы » Microsoft Windows » Быстрая настройка Windows (рабочее место)


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru