Browse Source

6.6.9 — 16.08.2024

master
Dmitry Nefedov 4 months ago
parent
commit
701efd0a92
  1. 1
      README.md
  2. 1
      README_de-de.md
  3. 1
      README_uk-ua.md
  4. 16
      Wrapper/Config/config_Windows_10.json
  5. 18
      Wrapper/Config/config_Windows_10_LTSC.json
  6. 16
      Wrapper/Config/config_Windows_11.json
  7. 20
      Wrapper/Localizations/de-DE/tooltip_Windows_10.json
  8. 18
      Wrapper/Localizations/de-DE/tooltip_Windows_11.json
  9. 24
      Wrapper/Localizations/en-US/tooltip_Windows_10.json
  10. 22
      Wrapper/Localizations/en-US/tooltip_Windows_11.json
  11. 28
      Wrapper/Localizations/ru-RU/tooltip_Windows_10.json
  12. 20
      Wrapper/Localizations/ru-RU/tooltip_Windows_11.json
  13. 14
      sophia_script_versions.json
  14. 6
      src/Sophia_Script_for_Windows_10/Functions.ps1
  15. 2
      src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
  16. 267
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  17. 23
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  18. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
  19. 2
      src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
  20. 87
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  21. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  22. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
  23. 2
      src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
  24. 269
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  25. 23
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  26. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
  27. 2
      src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
  28. 269
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  29. 23
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  30. 6
      src/Sophia_Script_for_Windows_11/Functions.ps1
  31. 2
      src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
  32. 184
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  33. 14
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  34. 6
      src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1
  35. 2
      src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1
  36. 198
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  37. 14
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1
  38. 8
      supported_windows_builds.json

1
README.md

@ -99,7 +99,6 @@
## Donations
<a href="https://yoomoney.ru/to/4100116615568835"><img src="https://yoomoney.ru/i/shop/iomoney_logo_color_example.png" width=220px height=46px align="left">
</a><a href="https://ko-fi.com/farag"><img src="https://www.ko-fi.com/img/githubbutton_sm.svg" width=220px height=46px align="left"></a>
| ![ko-fi](https://img.shields.io/badge/tether-168363?style=for-the-badge&logo=tether&logoColor=white) |

1
README_de-de.md

@ -99,7 +99,6 @@
## Spenden
<a href="https://yoomoney.ru/to/4100116615568835"><img src="https://yoomoney.ru/i/shop/iomoney_logo_color_example.png" width=220px height=46px align="left">
</a><a href="https://ko-fi.com/farag"><img src="https://www.ko-fi.com/img/githubbutton_sm.svg" width=220px height=46px align="left"></a>
| ![ko-fi](https://img.shields.io/badge/tether-168363?style=for-the-badge&logo=tether&logoColor=white) |

1
README_uk-ua.md

@ -99,7 +99,6 @@
## Пожертвування
<a href="https://yoomoney.ru/to/4100116615568835"><img src="https://yoomoney.ru/i/shop/iomoney_logo_color_example.png" width=220px height=46px align="left">
</a><a href="https://ko-fi.com/farag"><img src="https://www.ko-fi.com/img/githubbutton_sm.svg" width=220px height=46px align="left"></a>
| ![ko-fi](https://img.shields.io/badge/tether-168363?style=for-the-badge&logo=tether&logoColor=white) |

16
Wrapper/Config/config_Windows_10.json

@ -2151,6 +2151,22 @@
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Region": "Microsoft Defender & Security",
"Control": "cmb",
"Required": "false",
"Function": "DNSoverHTTPS",
"Arg": {
"Zero": {
"Tag": "Enable"
},
"One": {
"Tag": "Disable"
}
},
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Region": "Context menu",
"Control": "cmb",

18
Wrapper/Config/config_Windows_10_LTSC.json

@ -2001,6 +2001,24 @@
"LTSC2019": "true",
"LTSC2021": "true"
},
{
"Region": "Microsoft Defender & Security",
"Control": "cmb",
"Required": "false",
"Function": "DNSoverHTTPS",
"Arg": {
"Zero": {
"Tag": "Enable"
},
"One": {
"Tag": "Disable"
}
},
"Preset": "Zero",
"WindowsDefault": "One",
"LTSC2019": "false",
"LTSC2021": "true"
},
{
"Region": "Context menu",
"Control": "cmb",

16
Wrapper/Config/config_Windows_11.json

@ -690,6 +690,22 @@
"Preset": "",
"WindowsDefault": ""
},
{
"Region": "UI & Personalization",
"Control": "cmb",
"Required": "false",
"Function": "TaskbarEndTask",
"Arg": {
"Zero": {
"Tag": "Enable"
},
"One": {
"Tag": "Disable"
}
},
"Preset": "Zero",
"WindowsDefault": "One"
},
{
"Region": "UI & Personalization",
"Control": "cmb",

20
Wrapper/Localizations/de-DE/tooltip_Windows_10.json

@ -253,7 +253,7 @@
},
"One": {
"Tag": "Show",
"ToolTip": "Anzeigen von Microsoft-Konto-Benachrichtigungen im Startmenü im Startmenü. (Standardeinstellung)."
"ToolTip": "Anzeigen von Microsoft-Konto-Benachrichtigungen im Startmenü im Startmenü (Standardeinstellung)."
}
}
},
@ -1544,7 +1544,7 @@
{
"Region": "Start menu",
"Function": "PinToStart -Tiles",
"ToolTip": "Folgende Verknüpfungen: Systemsteuerung, Geräte und Drucker, PowerShell an das Startmenü anheften",
"ToolTip": "Folgende Verknüpfungen: Systemsteuerung, Geräte und Drucker, PowerShell an das Startmenü anheften.",
"Arg": {
"Zero": {
"Tag": "ControlPanel",
@ -1750,7 +1750,7 @@
},
"One": {
"Tag": "Disable",
"ToolTip": "Erkennung von potenziell unerwünschten Anwendungen deaktivieren. (Standardeinstellung)."
"ToolTip": "Erkennung von potenziell unerwünschten Anwendungen deaktivieren (Standardeinstellung)."
}
}
},
@ -1886,6 +1886,20 @@
}
}
},
{
"Region": "Microsoft Defender & Security",
"Function": "DNSoverHTTPS",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Aktiviert DNS-over-HTTPS für IPv4. Gültige IPv4-Adressen: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.91."
},
"One": {
"Tag": "Disable",
"ToolTip": "Deaktiviert DNS-over-HTTPS für IPv4 (Standardeinstellung)."
}
}
},
{
"Region": "Context menu",
"Function": "MSIExtractContext",

18
Wrapper/Localizations/de-DE/tooltip_Windows_11.json

@ -267,7 +267,7 @@
},
"One": {
"Tag": "Show",
"ToolTip": "Anzeigen von Microsoft-Konto-Benachrichtigungen im Startmenü im Startmenü. (Standardeinstellung)."
"ToolTip": "Anzeigen von Microsoft-Konto-Benachrichtigungen im Startmenü im Startmenü (Standardeinstellung)."
}
}
},
@ -579,7 +579,7 @@
"Arg": {
"Zero": {
"Tag": "Always",
"ToolTip": "Kombinieren Sie Schaltflächen in der Taskleiste und blenden Sie Beschriftungen immer aus. (default value)."
"ToolTip": "Kombinieren Sie Schaltflächen in der Taskleiste und blenden Sie Beschriftungen immer aus (Standardeinstellung)."
},
"One": {
"Tag": "Full",
@ -606,6 +606,20 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "TaskbarEndTask",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "\"Task beenden\" in Taskleiste durch Rechtsklick aktivieren."
},
"One": {
"Tag": "Disable",
"ToolTip": "\"Task beenden\" in Taskleiste durch Rechtsklick deaktivieren (Standardeinstellung)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "ControlPanelView",

24
Wrapper/Localizations/en-US/tooltip_Windows_10.json

@ -614,7 +614,7 @@
{
"Region": "UI & Personalization",
"Function": "UnpinTaskbarShortcuts -Shortcuts",
"ToolTip": "Unpin the \"Microsoft Edge\", \"Microsoft Store\", or \"Mail\" shortcuts from the taskbar",
"ToolTip": "Unpin the \"Microsoft Edge\", \"Microsoft Store\", or \"Mail\" shortcuts from the taskbar.",
"Arg": {
"Zero": {
"Tag": "Edge",
@ -1544,7 +1544,7 @@
{
"Region": "Start menu",
"Function": "PinToStart -Tiles",
"ToolTip": "Pin to Start the following shortcuts: Control Panel, Devices and Printers, PowerShell",
"ToolTip": "Pin to Start the following shortcuts: Control Panel, Devices and Printers, PowerShell.",
"Arg": {
"Zero": {
"Tag": "ControlPanel",
@ -1690,7 +1690,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"Windows Cleanup\" scheduled task for cleaning up Windows unused files and updates. A native interactive toast notification pops up every 30 days. You have to enable Windows Script Host in order to make the function work."
"ToolTip": "Create \"Windows Cleanup\" (main task) and \"Windows Cleanup Notification\" (task to generate a pop-up notification) tasks to clean up unused files and Windows updates in the Task Scheduler in the Sophia folder. A native notification prompting you to run the task will pop up before the cleanup begins. The task runs every 30 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",
@ -1704,7 +1704,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"SoftwareDistribution\" scheduled task for cleaning up the %SystemRoot%\\SoftwareDistribution\\Download folder. The task will wait until the Windows Updates service finishes running. The task runs every 90 days. You have to enable Windows Script Host in order to make the function work"
"ToolTip": "Create a \"SoftwareDistribution\" task to clean up the %SystemRoot%\\SoftwareDistribution\\Download folder where the installation files for all Windows updates are downloaded, in the Sophia folder in the Task Scheduler. The task will wait until the Windows Update service has finished running. The task runs every 90 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",
@ -1718,7 +1718,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"Temp\" scheduled task for cleaning up the %TEMP% folder. Only files older than one day will be deleted. The task runs every 60 days. You have to enable Windows Script Host in order to make the function work"
"ToolTip": "Create a \"Temp\" task in the Task Scheduler to clean up the %TEMP% folder. Only files older than one day will be deleted. The task runs every 60 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",
@ -1886,6 +1886,20 @@
}
}
},
{
"Region": "Microsoft Defender & Security",
"Function": "DNSoverHTTPS",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Enable DNS-over-HTTPS for IPv4. The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9."
},
"One": {
"Tag": "Disable",
"ToolTip": "Disable DNS-over-HTTPS for IPv4 (default value)."
}
}
},
{
"Region": "Context menu",
"Function": "MSIExtractContext",

22
Wrapper/Localizations/en-US/tooltip_Windows_11.json

@ -594,7 +594,7 @@
{
"Region": "UI & Personalization",
"Function": "UnpinTaskbarShortcuts -Shortcuts",
"ToolTip": "Unpin the \"Microsoft Edge\" and \"Microsoft Store\" shortcuts from the taskbar",
"ToolTip": "Unpin the \"Microsoft Edge\" and \"Microsoft Store\" shortcuts from the taskbar.",
"Arg": {
"Zero": {
"Tag": "Edge",
@ -606,6 +606,20 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "TaskbarEndTask",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Enable end task in taskbar by right click."
},
"One": {
"Tag": "Disable",
"ToolTip": "Disable end task in taskbar by right click (default value)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "ControlPanelView",
@ -1575,7 +1589,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"Windows Cleanup\" scheduled task for cleaning up Windows unused files and updates. A native interactive toast notification pops up every 30 days. You have to enable Windows Script Host in order to make the function work."
"ToolTip": "Create \"Windows Cleanup\" (main task) and \"Windows Cleanup Notification\" (task to generate a pop-up notification) tasks to clean up unused files and Windows updates in the Task Scheduler in the Sophia folder. A native notification prompting you to run the task will pop up before the cleanup begins. The task runs every 30 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",
@ -1589,7 +1603,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"SoftwareDistribution\" scheduled task for cleaning up the %SystemRoot%\\SoftwareDistribution\\Download folder. The task will wait until the Windows Updates service finishes running. The task runs every 90 days. You have to enable Windows Script Host in order to make the function work"
"ToolTip": "Create a \"SoftwareDistribution\" task to clean up the %SystemRoot%\\SoftwareDistribution\\Download folder where the installation files for all Windows updates are downloaded, in the Sophia folder in the Task Scheduler. The task will wait until the Windows Update service has finished running. The task runs every 90 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",
@ -1603,7 +1617,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Create the \"Temp\" scheduled task for cleaning up the %TEMP% folder. Only files older than one day will be deleted. The task runs every 60 days. You have to enable Windows Script Host in order to make the function work"
"ToolTip": "Create a \"Temp\" task in the Task Scheduler to clean up the %TEMP% folder. Only files older than one day will be deleted. The task runs every 60 days. Windows Script Host must be enabled for the task to run."
},
"One": {
"Tag": "Delete",

28
Wrapper/Localizations/ru-RU/tooltip_Windows_10.json

@ -607,14 +607,14 @@
},
"One": {
"Tag": "Hide",
"ToolTip": "Скрыть секунды в системных часах на панели задач (значение по умолчанию)"
"ToolTip": "Скрыть секунды в системных часах на панели задач (значение по умолчанию)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "UnpinTaskbarShortcuts -Shortcuts",
"ToolTip": "Открепить ярлыки \"Microsoft Edge\", \"Microsoft Store\" или \"Почта\" от панели задач",
"ToolTip": "Открепить ярлыки \"Microsoft Edge\", \"Microsoft Store\" или \"Почта\" от панели задач.",
"Arg": {
"Zero": {
"Tag": "Edge",
@ -840,11 +840,11 @@
"Arg": {
"Zero": {
"Tag": "Show",
"ToolTip": "Отобразить пользовательские папки в \"Этот компьютер\""
"ToolTip": "Отобразить пользовательские папки в \"Этот компьютер\"."
},
"One": {
"Tag": "Hide",
"ToolTip": "Скрыть пользовательские папки в \"Этот компьютер\""
"ToolTip": "Скрыть пользовательские папки в \"Этот компьютер\"."
}
}
},
@ -1544,7 +1544,7 @@
{
"Region": "Start menu",
"Function": "PinToStart -Tiles",
"ToolTip": "Закрепить на начальном экране следующие ярлыки: Панель управления, Устройства и принтеры, PowerShell",
"ToolTip": "Закрепить на начальном экране следующие ярлыки: Панель управления, Устройства и принтеры, PowerShell.",
"Arg": {
"Zero": {
"Tag": "ControlPanel",
@ -1690,7 +1690,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Создать задание \"Windows Cleanup\" по очистке неиспользуемых файлов и обновлений Windows в Планировщике заданий. Задание выполняется каждые 30 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
"ToolTip": "Создать задания \"Windows Cleanup\" (основное задание) и \"Windows Cleanup Notification\" (задание для создания всплывающего уведомления) по очистке неиспользуемых файлов и обновлений Windows в Планировщике заданий в папке Sophia. Перед началом очистки всплывет нативное уведомление Windows с предложением запустить задание. Задание выполняется каждые 30 дней. Для работы задания необходимо включить Windows Script Host."
},
"One": {
"Tag": "Delete",
@ -1704,7 +1704,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Создать задание \"SoftwareDistribution\" по очистке папки %SystemRoot%\\SoftwareDistribution\\Download в Планировщике заданий. Задание будет ждать, пока служба обновлений Windows не закончит работу. Задание выполняется каждые 90 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
"ToolTip": "Создать задание \"SoftwareDistribution\" по очистке папки %SystemRoot%\\SoftwareDistribution\\Download, куда скачиваются установочные файлы всех обновлений Windows, в папке Sophia в Планировщике заданий. Задание будет ждать, пока служба обновлений Windows не закончит работу. Задача выполняется каждые 90 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
},
"One": {
"Tag": "Delete",
@ -1886,6 +1886,20 @@
}
}
},
{
"Region": "Microsoft Defender & Security",
"Function": "DNSoverHTTPS",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Включить DNS-over-HTTPS для IPv4. Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9."
},
"One": {
"Tag": "Disable",
"ToolTip": "Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)."
}
}
},
{
"Region": "Context menu",
"Function": "MSIExtractContext",

20
Wrapper/Localizations/ru-RU/tooltip_Windows_11.json

@ -594,7 +594,7 @@
{
"Region": "UI & Personalization",
"Function": "UnpinTaskbarShortcuts -Shortcuts",
"ToolTip": "Открепить ярлыки \"Microsoft Edge\", \"Microsoft Store\" от панели задач",
"ToolTip": "Открепить ярлыки \"Microsoft Edge\", \"Microsoft Store\" от панели задач.",
"Arg": {
"Zero": {
"Tag": "Edge",
@ -606,6 +606,20 @@
}
}
},
{
"Region": "UI & Personalization",
"Function": "TaskbarEndTask",
"Arg": {
"Zero": {
"Tag": "Enable",
"ToolTip": "Включить завершение задачи на панели задач правой кнопкой мыши."
},
"One": {
"Tag": "Disable",
"ToolTip": "Выключить завершение задачи на панели задач правой кнопкой мыши (default value)."
}
}
},
{
"Region": "UI & Personalization",
"Function": "ControlPanelView",
@ -1575,7 +1589,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Создать задание \"Windows Cleanup\" по очистке неиспользуемых файлов и обновлений Windows в Планировщике заданий. Задание выполняется каждые 30 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
"ToolTip": "Создать задания \"Windows Cleanup\" (основное задание) и \"Windows Cleanup Notification\" (задание для создания всплывающего уведомления) по очистке неиспользуемых файлов и обновлений Windows в Планировщике заданий в папке Sophia. Перед началом очистки всплывет нативное уведомление Windows с предложением запустить задание. Задание выполняется каждые 30 дней. Для работы задания необходимо включить Windows Script Host."
},
"One": {
"Tag": "Delete",
@ -1589,7 +1603,7 @@
"Arg": {
"Zero": {
"Tag": "Register",
"ToolTip": "Создать задание \"SoftwareDistribution\" по очистке папки %SystemRoot%\\SoftwareDistribution\\Download в Планировщике заданий. Задание будет ждать, пока служба обновлений Windows не закончит работу. Задание выполняется каждые 90 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
"ToolTip": "Создать задание \"SoftwareDistribution\" по очистке папки %SystemRoot%\\SoftwareDistribution\\Download, куда скачиваются установочные файлы всех обновлений Windows, в папке Sophia в Планировщике заданий. Задание будет ждать, пока служба обновлений Windows не закончит работу. Задача выполняется каждые 90 дней. Необходимо включить Windows Script Host для того, чтобы работала функция."
},
"One": {
"Tag": "Delete",

14
sophia_script_versions.json

@ -1,10 +1,10 @@
{
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.8",
"Sophia_Script_Windows_10_PowerShell_7": "5.18.8",
"Sophia_Script_Windows_10_LTSC2019": "5.8.8",
"Sophia_Script_Windows_10_LTSC2021": "5.18.8",
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.8",
"Sophia_Script_Windows_11_LTSC2024": "6.6.8",
"Sophia_Script_Windows_11_PowerShell_7": "6.6.8",
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.9",
"Sophia_Script_Windows_10_PowerShell_7": "5.18.9",
"Sophia_Script_Windows_10_LTSC2019": "5.8.9",
"Sophia_Script_Windows_10_LTSC2021": "5.18.9",
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.9",
"Sophia_Script_Windows_11_LTSC2024": "6.6.9",
"Sophia_Script_Windows_11_PowerShell_7": "6.6.9",
"Sophia_Script_Wrapper": "2.7.1"
}

6
src/Sophia_Script_for_Windows_10/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.18.8'
ModuleVersion = '5.18.9'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

267
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -282,11 +282,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -405,7 +407,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -769,9 +771,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1749,6 +1748,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -4703,9 +4703,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4822,9 +4819,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -6189,6 +6183,7 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6554,6 +6549,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6862,9 +6858,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -10294,7 +10287,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -10304,6 +10297,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -10555,8 +10570,6 @@ function Install-WSL
try
{
[System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode
# https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json
# wsl --list --online relies on Internet connection too, so it's much convenient to parse DistributionInfo.json, rather than parse a cmd output
$Parameters = @{
@ -10673,6 +10686,7 @@ function Install-WSL
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -11178,6 +11192,7 @@ function UninstallUWPApps
# HEVC Video Extensions from Device Manufacturer
"Microsoft.HEVCVideoExtension",
"Microsoft.HEVCVideoExtensions",
# Raw Image Extension
"Microsoft.RawImageExtension",
@ -11523,6 +11538,7 @@ function UninstallUWPApps
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -12194,16 +12210,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -12260,40 +12278,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""
@ -13827,6 +13811,181 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.EXAMPLE
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
.EXAMPLE Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
DNSoverHTTPS -ComssOneDNS
.EXAMPLE
DNSoverHTTPS -Disable
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://docs.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $SecondaryDNS
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $PrimaryDNS
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch breing created, so we need to use different method to isolate the proper adapter
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetAdapter -Physical).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetRoute -AddressFamily IPv4 | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force
}
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force
}
# Encrypted preffered, unencrypted allowed
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
}
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

23
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10"
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-LocalizedData -BindingVariable Global:Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia
@ -1307,6 +1307,23 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value)
# Выключить Windows Sandbox (значение по умолчанию)
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.8.8
Date: 06.07.2024
Version: v5.8.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.8.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.8.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.8.8'
ModuleVersion = '5.8.9'
GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

87
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.8.8
Date: 06.07.2024
Version: v5.8.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -282,11 +282,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -380,7 +382,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -739,9 +741,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1706,6 +1705,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {($_.ProcessName -eq "powershell") -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2019")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -3667,9 +3667,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -3786,9 +3783,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4856,6 +4850,7 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {($_.ProcessName -eq "powershell") -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2019")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -5206,6 +5201,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {($_.ProcessName -eq "powershell") -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2019")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -5514,9 +5510,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -8545,7 +8538,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -8555,6 +8548,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -9049,16 +9064,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -9115,40 +9132,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2019"
Version: v5.8.8
Date: 06.07.2024
Version: v5.8.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.8.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.8.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-LocalizedData -BindingVariable Global:Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia

6
src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.18.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.18.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.18.8'
ModuleVersion = '5.18.9'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

269
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -282,11 +282,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -380,7 +382,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -739,9 +741,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1706,7 +1705,8 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
Get-Process | Where-Object -FilterScript {($_.ProcessName -eq "powershell") -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC")} | ForEach-Object -Process {
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -4043,9 +4043,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4162,9 +4159,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -5233,7 +5227,8 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
Get-Process | Where-Object -FilterScript {($_.ProcessName -eq "powershell") -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2021")} | ForEach-Object -Process {
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2021")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -5598,6 +5593,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2021")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -5906,9 +5902,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -9176,7 +9169,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -9186,6 +9179,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -9437,8 +9452,6 @@ function Install-WSL
try
{
[System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode
# https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json
# wsl --list --online relies on Internet connection too, so it's much convenient to parse DistributionInfo.json, rather than parse a cmd output
$Parameters = @{
@ -9555,6 +9568,7 @@ function Install-WSL
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2021")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -10183,16 +10197,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -10249,40 +10265,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""
@ -11808,6 +11790,181 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.EXAMPLE
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
.EXAMPLE Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
DNSoverHTTPS -ComssOneDNS
.EXAMPLE
DNSoverHTTPS -Disable
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://docs.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $SecondaryDNS
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $PrimaryDNS
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch breing created, so we need to use different method to isolate the proper adapter
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetAdapter -Physical).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetRoute -AddressFamily IPv4 | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force
}
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force
}
# Encrypted preffered, unencrypted allowed
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
}
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

23
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2021"
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.18.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.18.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-LocalizedData -BindingVariable Global:Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia
@ -1113,6 +1113,23 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value)
# Выключить Windows Sandbox (значение по умолчанию)
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

6
src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.8 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.9 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.18.8'
ModuleVersion = '5.18.9'
GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

269
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -281,11 +281,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -404,7 +406,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -773,9 +775,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1753,6 +1752,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -3971,7 +3971,7 @@ function UnpinTaskbarShortcuts
$Shell = (New-Object -ComObject Shell.Application).NameSpace("$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")
$Shortcut = $Shell.ParseName("Microsoft Edge.lnk")
# Extract the localized "Unpin from taskbar" string from shell32.dll
$Shortcut.Verbs() | Where-Object -FilterScript {$_.Name -eq "$([WinAPI.GetStrings]::GetString(5387))"} | ForEach-Object -Process {$_.DoIt()}
$Shortcut.Verbs() | Where-Object -FilterScript {$_.Name -eq $LocalizedString} | ForEach-Object -Process {$_.DoIt()}
}
}
Store
@ -4707,9 +4707,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4826,9 +4823,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -6195,6 +6189,7 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6560,6 +6555,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6868,9 +6864,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -10300,7 +10293,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -10310,6 +10303,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -10561,8 +10576,6 @@ function Install-WSL
try
{
[System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode
# https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json
# wsl --list --online relies on Internet connection too, so it's much convenient to parse DistributionInfo.json, rather than parse a cmd output
$Parameters = @{
@ -10679,6 +10692,7 @@ function Install-WSL
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -11194,6 +11208,7 @@ function UninstallUWPApps
# HEVC Video Extensions from Device Manufacturer
"Microsoft.HEVCVideoExtension",
"Microsoft.HEVCVideoExtensions",
# Raw Image Extension
"Microsoft.RawImageExtension",
@ -11539,6 +11554,7 @@ function UninstallUWPApps
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -12210,16 +12226,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -12276,40 +12294,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""
@ -13843,6 +13827,181 @@ function WindowsSandbox
}
}
}
<#
.SYNOPSIS
DNS-over-HTTPS for IPv4
.PARAMETER Enable
Enable DNS-over-HTTPS for IPv4
.PARAMETER Disable
Disable DNS-over-HTTPS for IPv4
.EXAMPLE
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
.EXAMPLE Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
DNSoverHTTPS -ComssOneDNS
.EXAMPLE
DNSoverHTTPS -Disable
.NOTES
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
.LINK
https://docs.microsoft.com/en-us/windows-server/networking/dns/doh-client-support
.LINK
https://www.comss.ru/page.php?id=7315
.NOTES
Machine-wide
#>
function DNSoverHTTPS
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $SecondaryDNS
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
[ValidateScript({
# Check if $PrimaryDNS is not equal to $SecondaryDNS
$_ -ne $PrimaryDNS
})]
[string]
$SecondaryDNS,
# https://www.comss.ru/page.php?id=7315
[Parameter(
Mandatory = $true,
ParameterSetName = "ComssOneDNS"
)]
[switch]
$ComssOneDNS,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
# Determining whether Hyper-V is enabled
# After enabling Hyper-V feature a virtual switch breing created, so we need to use different method to isolate the proper adapter
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$InterfaceGuids = @((Get-NetAdapter -Physical).InterfaceGuid)
}
else
{
$InterfaceGuids = @((Get-NetRoute -AddressFamily IPv4 | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter).InterfaceGuid)
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses $PrimaryDNS, $SecondaryDNS
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Force
}
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Force
}
# Encrypted preffered, unencrypted allowed
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$PrimaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\$SecondaryDNS" -Name DohFlags -PropertyType QWord -Value 5 -Force
}
}
"ComssOneDNS"
{
switch ((Get-WinHomeLocation).GeoId)
{
{($_ -ne 203) -and ($_ -ne 29)}
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
}
# Set a primary and secondary DNS servers
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
else
{
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses 92.223.65.71
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
if (-not (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71"))
{
New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Force
}
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohFlags -PropertyType QWord -Value 2 -Force
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh\92.223.65.71" -Name DohTemplate -PropertyType String -Value https://dns.comss.one/dns-query -Force
}
}
"Disable"
{
# Determining whether Hyper-V is enabled
if (-not (Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
# Configure DNS servers automatically
Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Set-DnsClientServerAddress -ResetServerAddresses
}
else
{
# Configure DNS servers automatically
Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Set-DnsClientServerAddress -ResetServerAddresses
}
foreach ($InterfaceGuid in $InterfaceGuids)
{
Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\InterfaceSpecificParameters\$InterfaceGuid\DohInterfaceSettings\Doh" -Recurse -Force -ErrorAction Ignore
}
}
}
Clear-DnsClientCache
Register-DnsClient
}
#endregion Microsoft Defender & Security
#region Context menu

23
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 (PowerShell 7)"
Version: v5.18.8
Date: 06.07.2024
Version: v5.18.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.8 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.9 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
@ -1318,6 +1318,23 @@ SaveZoneInformation -Disable
# Disable Windows Sandbox (default value)
# Выключить Windows Sandbox (значение по умолчанию)
# WindowsSandbox -Disable
<#
Enable DNS-over-HTTPS for IPv4
The valid IPv4 addresses: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
Включить DNS-over-HTTPS для IPv4
Действительные IPv4-адреса: 1.0.0.1, 1.1.1.1, 149.112.112.112, 8.8.4.4, 8.8.8.8, 9.9.9.9
#>
DNSoverHTTPS -Enable -PrimaryDNS 1.0.0.1 -SecondaryDNS 1.1.1.1
# Disable DNS-over-HTTPS for IPv4 (default value)
# Выключить DNS-over-HTTPS для IPv4 (значение по умолчанию)
# DNSoverHTTPS -Disable
# Enable DNS-over-HTTPS via Comss.one DNS server. Applicable for Russia only
# Включить DNS-over-HTTPS для IPv4 через DNS-сервер Comss.one. Применимо только для России
# DNSoverHTTPS -ComssOneDNS
#endregion Microsoft Defender & Security
#region Context menu

6
src/Sophia_Script_for_Windows_11/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '6.6.8'
ModuleVersion = '6.6.9'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

184
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -268,11 +268,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -391,7 +393,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -743,9 +745,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1729,6 +1728,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -3197,14 +3197,32 @@ function TaskbarWidgets
{
if (Get-AppxPackage -Name MicrosoftWindows.Client.WebExperience)
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 0 -Force
# Microsoft blocked access for editing TaskbarDa key in KB5041585
try
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 0 -Force -ErrorAction Stop
}
catch [System.UnauthorizedAccessException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
}
}
}
"Show"
{
if (Get-AppxPackage -Name MicrosoftWindows.Client.WebExperience)
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 1 -Force
# Microsoft blocked access for editing TaskbarDa key in KB5041585
try
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 1 -Force -ErrorAction Stop
}
catch [System.UnauthorizedAccessException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
}
}
}
}
@ -3712,6 +3730,62 @@ function UnpinTaskbarShortcuts
}
}
<#
.SYNOPSIS
End task in taskbar by right click
.PARAMETER Enable
Enable end task in taskbar by right click
.PARAMETER Disable
Disable end task in taskbar by right click
.EXAMPLE
TaskbarEndTask -Enable
.EXAMPLE
TaskbarEndTask -Disable
.NOTES
Current user
#>
function TaskbarEndTask
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings))
{
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Force
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Name TaskbarEndTask -PropertyType DWord -Value 1 -Force
}
"Disable"
{
Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Name TaskbarEndTask -Force -ErrorAction Ignore
}
}
}
<#
.SYNOPSIS
The Control Panel icons view
@ -4293,9 +4367,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4412,9 +4483,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -5779,6 +5847,7 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6141,6 +6210,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6653,9 +6723,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -9906,7 +9973,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -9916,6 +9983,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -10167,8 +10256,6 @@ function Install-WSL
try
{
[System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode
# https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json
# wsl --list --online relies on Internet connection too, so it's much convenient to parse DistributionInfo.json, rather than parse a cmd output
$Parameters = @{
@ -10285,6 +10372,7 @@ function Install-WSL
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -10514,6 +10602,7 @@ function UninstallUWPApps
# HEVC Video Extensions from Device Manufacturer
"Microsoft.HEVCVideoExtension",
"Microsoft.HEVCVideoExtensions",
# Raw Image Extension
"Microsoft.RawImageExtension",
@ -10859,6 +10948,7 @@ function UninstallUWPApps
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -11355,16 +11445,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -11421,40 +11513,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""
@ -13031,19 +13089,17 @@ function DNSoverHTTPS
$Enable,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
# Isolate the IPv4 addresses only
[ValidateScript({
(@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}) -contains $_
# isolate IPv4 IP addresses and check if $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"}) -contains $_) -and ($_ -ne $SecondaryDNS)
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
# Isolate the IPv4 addresses only
[ValidateScript({
(@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}) -contains $_
# isolate IPv4 IP addresses and check if $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"}) -contains $_) -and ($_ -ne $PrimaryDNS)
})]
[string]
$SecondaryDNS,
@ -13770,8 +13826,8 @@ function OpenWindowsTerminalAdminContext
}
catch [System.ArgumentException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
Write-Warning -Message (($Global:Error.Exception.Message | Select-Object -First 1))
Write-Error -Message (($Global:Error.Exception.Message | Select-Object -First 1)) -ErrorAction SilentlyContinue
Invoke-Item -Path "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState"

14
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 11"
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -68,7 +68,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-LocalizedData -BindingVariable Global:Localization -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia
@ -465,6 +465,14 @@ TaskbarCombine -Always
# Открепить ярлыки "Microsoft Edge", "Microsoft Store" от панели задач
UnpinTaskbarShortcuts -Shortcuts Edge, Store
# Enable end task in taskbar by right click
# Включить завершение задачи на панели задач правой кнопкой мыши
TaskbarEndTask -Enable
# Disable end task in taskbar by right click (default value)
# Выключить завершение задачи на панели задач правой кнопкой мыши (значение по умолчанию)
# TaskbarEndTask -Disable
# View the Control Panel icons by large icons
# Просмотр иконок Панели управления как: крупные значки
ControlPanelView -LargeIcons

6
src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -49,7 +49,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.8 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '6.6.8'
ModuleVersion = '6.6.9'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

198
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -267,11 +267,13 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Check whether Windows was broken by 3rd party harmful tweakers and trojans
$Tweakers = @{
# https://forum.ru-board.com/topic.cgi?forum=62&topic=30617&start=1600#14
AutoSettingsPS = "$(Get-WinEvent -LogName `"Windows PowerShell`" | Where-Object -FilterScript {($_.Id -eq 800) -and ($_.Message -match `"AutoSettingsPS`")} | Select-Object -First 1)"
AutoSettingsPS = "$(Get-Item -Path `"HKLM:\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths`" | Where-Object -FilterScript {$_.Property -match `"AutoSettingsPS`"})"
# Flibustier custom Windows image
Flibustier = "$(Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\.NETFramework\Performance -Name *flibustier)"
# https://github.com/builtbybel/Winpilot
Winpilot = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Winpilot`"})"
# https://github.com/builtbybel/xd-AntiSpy
"xd-AntiSpy" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"xd-AntiSpy`"})"
# https://forum.ru-board.com/topic.cgi?forum=5&topic=50519
"Modern Tweaker" = "$((Get-ItemProperty -Path `"HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache`").PSObject.Properties | Where-Object -FilterScript {$_.Value -eq `"Modern Tweaker`"})"
}
@ -390,7 +392,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
# Provider Load Failure exception
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
@ -596,20 +598,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
exit
}
if ((Get-WindowsEdition -Online).Edition -match "EnterpriseS")
{
# Will be removed when Windows 11 Enterprise LTSC will be released officially this Autumn along side with 24H2
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message "You're using a leaked Windows 11 Enterprise LTSC image. The official release set to November."
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements" -Verbose
exit
}
# Detect Windows build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{
@ -761,9 +749,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -1747,6 +1732,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -3215,14 +3201,32 @@ function TaskbarWidgets
{
if (Get-AppxPackage -Name MicrosoftWindows.Client.WebExperience)
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 0 -Force
# Microsoft blocked access for editing TaskbarDa key in KB5041585
try
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 0 -Force -ErrorAction Stop
}
catch [System.UnauthorizedAccessException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
}
}
}
"Show"
{
if (Get-AppxPackage -Name MicrosoftWindows.Client.WebExperience)
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 1 -Force
# Microsoft blocked access for editing TaskbarDa key in KB5041585
try
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name TaskbarDa -PropertyType DWord -Value 1 -Force -ErrorAction Stop
}
catch [System.UnauthorizedAccessException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
}
}
}
}
@ -3730,6 +3734,62 @@ function UnpinTaskbarShortcuts
}
}
<#
.SYNOPSIS
End task in taskbar by right click
.PARAMETER Enable
Enable end task in taskbar by right click
.PARAMETER Disable
Disable end task in taskbar by right click
.EXAMPLE
TaskbarEndTask -Enable
.EXAMPLE
TaskbarEndTask -Disable
.NOTES
Current user
#>
function TaskbarEndTask
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "Enable"
)]
[switch]
$Enable,
[Parameter(
Mandatory = $true,
ParameterSetName = "Disable"
)]
[switch]
$Disable
)
if (-not (Test-Path -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings))
{
New-Item -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Force
}
switch ($PSCmdlet.ParameterSetName)
{
"Enable"
{
New-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Name TaskbarEndTask -PropertyType DWord -Value 1 -Force
}
"Disable"
{
Remove-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarDeveloperSettings -Name TaskbarEndTask -Force -ErrorAction Ignore
}
}
}
<#
.SYNOPSIS
The Control Panel icons view
@ -4311,9 +4371,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -4430,9 +4487,6 @@ function Cursors
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -5799,6 +5853,7 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6161,6 +6216,7 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -6673,9 +6729,6 @@ function IPv6Component
}
if (-not (Invoke-WebRequest @Parameters).StatusDescription)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose
return
}
@ -9926,7 +9979,7 @@ function RKNBypass
"Enable"
{
# If current region is Russia
if (((Get-WinHomeLocation).GeoId -eq "203"))
if ((Get-WinHomeLocation).GeoId -eq "203")
{
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -PropertyType String -Value "https://p.thenewone.lol:8443/proxy.pac" -Force
}
@ -9936,6 +9989,28 @@ function RKNBypass
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name AutoConfigURL -Force -ErrorAction Ignore
}
}
$Signature = @{
Namespace = "WinAPI"
Name = "wininet"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("wininet.dll", SetLastError = true, CharSet=CharSet.Auto)]
public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
"@
}
if (-not ("WinAPI.wininet" -as [type]))
{
Add-Type @Signature
}
# Apply changed proxy settings
# https://learn.microsoft.com/en-us/windows/win32/wininet/option-flags
$INTERNET_OPTION_SETTINGS_CHANGED = 39
$INTERNET_OPTION_REFRESH = 37
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
[WinAPI.wininet]::InternetSetOption(0, $INTERNET_OPTION_REFRESH, 0, 0)
}
<#
@ -10187,8 +10262,6 @@ function Install-WSL
try
{
[System.Console]::OutputEncoding = [System.Text.Encoding]::Unicode
# https://github.com/microsoft/WSL/blob/master/distributions/DistributionInfo.json
# wsl --list --online relies on Internet connection too, so it's much convenient to parse DistributionInfo.json, rather than parse a cmd output
$Parameters = @{
@ -10305,6 +10378,7 @@ function Install-WSL
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -10544,6 +10618,7 @@ function UninstallUWPApps
# HEVC Video Extensions from Device Manufacturer
"Microsoft.HEVCVideoExtension",
"Microsoft.HEVCVideoExtensions",
# Raw Image Extension
"Microsoft.RawImageExtension",
@ -10889,6 +10964,7 @@ function UninstallUWPApps
Add-Type -AssemblyName System.Windows.Forms
# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 11")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)
@ -11385,16 +11461,18 @@ function CleanupTask
}
$VolumeCaches = @(
"Delivery Optimization Files",
"BranchCache",
"Delivery Optimization Files",
"Device Driver Packages",
"Language Pack",
"Previous Installations",
"Setup Log Files",
"System error memory dump files",
"System error minidump files",
"Temporary Files",
"Temporary Setup Files",
"Update Cleanup",
"Upgrade Discarded Files",
"Windows Defender",
"Windows ESD installation files",
"Windows Upgrade Log Files"
@ -11451,40 +11529,6 @@ Get-Process -Name cleanmgr, Dism, DismHost | Stop-Process -Force
Start-Sleep -Seconds 3
[int]`$SourceMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
while (`$true)
{
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("""System.dll""")
`$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new(`$env:TEMP, `$false)
`$CompilerParameters.GenerateInMemory = `$true
`$Signature = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
CompilerParameters = `$CompilerParameters
MemberDefinition = @"""
[DllImport("""user32.dll""")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"""@
}
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
break
}
Start-Sleep -Milliseconds 5
}
`$ProcessInfo = New-Object -TypeName System.Diagnostics.ProcessStartInfo
`$ProcessInfo.FileName = """`$env:SystemRoot\System32\Dism.exe"""
`$ProcessInfo.Arguments = """/Online /English /Cleanup-Image /StartComponentCleanup /NoRestart"""
@ -13061,19 +13105,17 @@ function DNSoverHTTPS
$Enable,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
# Isolate the IPv4 addresses only
[ValidateScript({
(@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}) -contains $_
# isolate IPv4 IP addresses and check if $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"}) -contains $_) -and ($_ -ne $SecondaryDNS)
})]
[string]
$PrimaryDNS,
[Parameter(Mandatory = $false)]
[ValidateSet("1.0.0.1", "1.1.1.1", "149.112.112.112", "8.8.4.4", "8.8.8.8", "9.9.9.9")]
# Isolate the IPv4 addresses only
[ValidateScript({
(@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}) -contains $_
# isolate IPv4 IP addresses and check if $PrimaryDNS is not equal to $SecondaryDNS
((@((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object -FilterScript {($_ -as [IPAddress]).AddressFamily -ne "InterNetworkV6"}) -contains $_) -and ($_ -ne $PrimaryDNS)
})]
[string]
$SecondaryDNS,
@ -13800,8 +13842,8 @@ function OpenWindowsTerminalAdminContext
}
catch [System.ArgumentException]
{
Write-Warning -Message ($Global:Error.Exception.Message | Select-Object -First 1)
Write-Error -Message ($Global:Error.Exception.Message | Select-Object -First 1) -ErrorAction SilentlyContinue
Write-Warning -Message (($Global:Error.Exception.Message | Select-Object -First 1))
Write-Error -Message (($Global:Error.Exception.Message | Select-Object -First 1)) -ErrorAction SilentlyContinue
Invoke-Item -Path "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState"

14
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 11 (PowerShell 7)"
Version: v6.6.8
Date: 06.07.2024
Version: v6.6.9
Date: 16.08.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -68,7 +68,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.8 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.9 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
@ -476,6 +476,14 @@ TaskbarCombine -Always
# Открепить ярлыки "Microsoft Edge", "Microsoft Store" от панели задач
UnpinTaskbarShortcuts -Shortcuts Edge, Store
# Enable end task in taskbar by right click
# Включить завершение задачи на панели задач правой кнопкой мыши
TaskbarEndTask -Enable
# Disable end task in taskbar by right click (default value)
# Выключить завершение задачи на панели задач правой кнопкой мыши (значение по умолчанию)
# TaskbarEndTask -Disable
# View the Control Panel icons by large icons
# Просмотр иконок Панели управления как: крупные значки
ControlPanelView -LargeIcons

8
supported_windows_builds.json

@ -1,10 +1,10 @@
{
"Windows_10_URL": "https://support.microsoft.com/en-us/topic/windows-10-update-history-8127c2c6-6edf-4fdf-8b9f-0f7be1ef3562",
"Windows_10": "4651",
"Windows_10": "780",
"Windows_10_LTSC_2019_URL": "https://support.microsoft.com/en-us/topic/windows-10-and-windows-server-2019-update-history-725fc2e1-4443-6831-a5ca-51ff5cbcb059",
"Windows_10_LTSC_2019": "6054",
"Windows_10_LTSC_2019": "6189",
"Windows_10_LTSC_2021_URL": "https://support.microsoft.com/en-us/topic/windows-10-update-history-857b8ccb-71e4-49e5-b3f6-7073197d98fb",
"Windows_10_LTSC_2021": "4651",
"Windows_10_LTSC_2021": "4780",
"Windows_11_URL": "https://support.microsoft.com/en-us/topic/windows-11-version-23h2-update-history-59875222-b990-4bd9-932f-91a5954de434",
"Windows_11": "3880"
"Windows_11": "4037"
}

Loading…
Cancel
Save