farag
Silver Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Код: # Службы диагностического отслеживания Get-Service DiagTrack | Stop-Service Get-Service DiagTrack | Set-Service -StartupType Disabled # Отключить отправку отчетов об ошибках 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 # Задачи диагностического отслеживания Get-ScheduledTask AitAgent, BackupTask, BthSQM, Consolidator, FamilySafetyMonitor, FamilySafetyRefresh, FamilySafetyUpload, "File History (maintenance mode)", GatherNetworkInfo, "Idle Sync Maintenance Task", KernelCeipTask, "Microsoft Compatibility Appraiser", Microsoft-Windows-DiskDiagnosticDataCollector, "MNO Metadata Parser", NetworkStateChangeTask, ProgramDataUpdater, Proxy, QueueReporting, "Routine Maintenance Task", SilentCleanup, SmartScreenSpecific, StartupAppTask, UsbCeip, WinSAT, SqmUpload_* | Disable-ScheduledTask # Отключение телеметрии и сбора данных для отправки IF (!(Test-Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener)) { New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener -Force } New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AutoLogger-Diagtrack-Listener -Name Start -Value 0 -Force Remove-Item $env:ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl -ErrorAction SilentlyContinue -Force IF (!(Test-Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\SQMLogger)) { New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\SQMLogger -Force } New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\SQMLogger -Name Start -Value 0 -Force Remove-Item $env:SYSTEMROOT\System32\LogFiles\SQM\SQMLogger.etl -ErrorAction SilentlyContinue -Force # Отключение в "Журналах Windows/Безопасность" сообщения "Платформа фильтрации IP-пакетов Windows разрешила подключение" auditpol /set /subcategory:"{0CCE9226-69AE-11D9-BED3-505054503030}" /success:disable /failure:disable # Открывать "Этот компьютер" в Проводнике 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\HideDesktopIcons\NewStartPanel -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 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 # Подтверждение удаления файлов 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 HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments)) { New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments -Force } New-ItemProperty -Path HKCU:\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 # Сохранение скриншотов по 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 $env:USERPROFILE\Desktop -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 # Отключение обновления до Windows 10 IF (!(Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate)) { New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Force } New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate -Name DisableOSUpgrade -Value 1 -Force # IF (!(Test-Path HKLM:\Software\Policies\Microsoft\Windows\GWX)) { New-Item -Path HKLM:\Software\Policies\Microsoft\Windows\GWX -Force } New-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\GWX -Name DisableGwx -Value 1 -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 | Remove-AppxPackage -ErrorAction SilentlyContinue Get-AppxProvisionedPackage -Online | 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 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[]]@()) -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 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[]]@()) -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[]]@()) -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 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[]]@()) -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[]]@()) -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[]]@()) -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_.bmp -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_.tiff -Value 0 -Force New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts -Name PBrush_.tif -Value 0 -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.bmp\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Bitmap -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpg\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Jpeg -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.jpeg\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Jpeg -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.png\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Png -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tiff\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Tiff -Force New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Roaming\OpenWith\FileExts\.tif\UserChoice" -Name ProgId -Value PhotoViewer.FileAssoc.Tiff -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 -Force } New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive -Name DisableFileSyncNGSC -Value 1 -Force # Включить автоматическое обновление для других продуктов Microsoft $update = New-Object -ComObject Microsoft.Update.ServiceManager $update.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") Remove-Variable update # Блокировка рекламы в hosts $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 # Выключение Восстановления системы 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\Explorer\VolumeCaches)) { New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches -Force } $basekey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches" $keys = @( "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 Archive Files" "Windows Error Reporting Queue Files" "Windows Error Reporting System Archive Files" "Windows Error Reporting System Queue 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 $params = @{ "TaskName" = "Cleanmg" "Action" = $action "Trigger" = $trigger "Settings" = $settings } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable basekey, keys, action, trigger, settings, 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 61 -At 9am $settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $params = @{ "TaskName" = "Temp" "Action" = $action "Trigger" = $trigger "Settings" = $settings } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable action, trigger, settings, 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 $params = @{ "TaskName" = "SoftwareDistribution" "Action" = $action "Trigger" = $trigger "Settings" = $settings } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable getservice, action, trigger, settings, 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 $params = @{ "TaskName" = "Office" "Action" = $action "Trigger" = $trigger "Settings" = $settings } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable getservice, action, trigger, settings, 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 $params = @{ "TaskName" = "LiveKernelReports" "Action" = $action "Trigger" = $trigger "Settings" = $settings } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable dir, foldersize, action, trigger, settings, 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 } Register-ScheduledTask @Params -User System -RunLevel Highest -Force Remove-Variable foldersize, action, trigger, settings, 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 # Установить схему управления питания на "Высокая производительность" 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 # Использовать сценарий автоматической настройки прокси в 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 # Добавить в исключение Windows Defender папку $task = @" @{ GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' Author="Microsoft Corporation" CompanyName="Microsoft Corporation" Copyright="© Microsoft Corporation. All rights reserved." ModuleVersion = '1.0' NestedModules = @( 'MSFT_MpComputerStatus.cdxml', 'MSFT_MpPreference.cdxml', 'MSFT_MpThreat.cdxml', 'MSFT_MpThreatCatalog.cdxml', 'MSFT_MpThreatDetection.cdxml', 'MSFT_MpScan.cdxml', 'MSFT_MpSignature.cdxml') AliasesToExport = @() FunctionsToExport = @( 'Get-MpPreference', 'Set-MpPreference', 'Add-MpPreference', 'Remove-MpPreference', 'Get-MpComputerStatus', 'Get-MpThreat', 'Get-MpThreatCatalog', 'Get-MpThreatDetection', 'Start-MpScan', 'Update-MpSignature', 'Remove-MpThreat') PowerShellVersion = '3.0' HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390762" } "@ Add-Content $env:SystemDrive\Defender.psd1 $task -Force cmd.exe /c "takeown /F %WINDIR%\system32\WindowsPowerShell\v1.0\Modules\Defender\Defender.psd1" cmd.exe /c "icacls %WINDIR%\system32\WindowsPowerShell\v1.0\Modules\Defender\Defender.psd1 /grant:r %username%:F" Copy-Item $env:SystemDrive\Defender.psd1 $env:SystemRoot\System32\WindowsPowerShell\v1.0\Modules\Defender -Force 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 # Всегда ждать сеть при запуске и входе в систему 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 "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 # Не выполнять мастер запуска 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\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 # Открепить значок Магазина на панели задач IF (!(Test-Path HKCU:\Software\Policies\Microsoft\Windows\Explorer)) { New-Item -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Force } New-ItemProperty -Path HKCU:\Software\Policies\Microsoft\Windows\Explorer -Name NoPinningStoreToTaskbar -Value 1 -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 # Удаление пункта "Включить 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 # Открепить от панели задач 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) (New-Object -Com Shell.Application).NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}").Items() | ForEach-Object { $_.Verbs() | Where-Object {$_.Name -eq $unpinFromStart} | ForEach-Object {$_.DoIt()}} Remove-Variable getstring, unpinFromStart # Добавить пункт "Извлечь" для 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 Stop-Process -ProcessName explorer | | Всего записей: 2477 | Зарегистр. 27-07-2009 | Отправлено: 20:51 12-12-2017 | Исправлено: farag, 21:08 12-12-2017 |
|