Browse Source

Code refactoring

master 6.6.4
Dmitry Nefedov 7 months ago
parent
commit
d12c81b099
  1. 24
      Download_Sophia.ps1
  2. 10
      README.md
  3. 10
      README_de-de.md
  4. 14
      README_uk-ua.md
  5. BIN
      Wrapper/SophiaScriptWrapper.exe
  6. 14
      sophia_script_versions.json
  7. 6
      src/Sophia_Script_for_Windows_10/Functions.ps1
  8. 1
      src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1
  9. 1
      src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1
  10. 1
      src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1
  11. 1
      src/Sophia_Script_for_Windows_10/Localizations/fr-FR/Sophia.psd1
  12. 1
      src/Sophia_Script_for_Windows_10/Localizations/hu-HU/Sophia.psd1
  13. 1
      src/Sophia_Script_for_Windows_10/Localizations/it-IT/Sophia.psd1
  14. 1
      src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1
  15. 1
      src/Sophia_Script_for_Windows_10/Localizations/pt-BR/Sophia.psd1
  16. 1
      src/Sophia_Script_for_Windows_10/Localizations/ru-RU/Sophia.psd1
  17. 1
      src/Sophia_Script_for_Windows_10/Localizations/tr-TR/Sophia.psd1
  18. 1
      src/Sophia_Script_for_Windows_10/Localizations/uk-UA/Sophia.psd1
  19. 1
      src/Sophia_Script_for_Windows_10/Localizations/zh-CN/Sophia.psd1
  20. 2
      src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
  21. 386
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  22. 12
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  23. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
  24. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/de-DE/Sophia.psd1
  25. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/en-US/Sophia.psd1
  26. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/es-ES/Sophia.psd1
  27. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/fr-FR/Sophia.psd1
  28. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/hu-HU/Sophia.psd1
  29. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/it-IT/Sophia.psd1
  30. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1
  31. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pt-BR/Sophia.psd1
  32. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/ru-RU/Sophia.psd1
  33. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/tr-TR/Sophia.psd1
  34. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/uk-UA/Sophia.psd1
  35. 1
      src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/zh-CN/Sophia.psd1
  36. 2
      src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
  37. 375
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  38. 12
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  39. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
  40. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/de-DE/Sophia.psd1
  41. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/en-US/Sophia.psd1
  42. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/es-ES/Sophia.psd1
  43. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/fr-FR/Sophia.psd1
  44. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/hu-HU/Sophia.psd1
  45. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/it-IT/Sophia.psd1
  46. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1
  47. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pt-BR/Sophia.psd1
  48. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/ru-RU/Sophia.psd1
  49. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/tr-TR/Sophia.psd1
  50. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/uk-UA/Sophia.psd1
  51. 1
      src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/zh-CN/Sophia.psd1
  52. 2
      src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
  53. 375
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  54. 12
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  55. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
  56. 2
      src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
  57. 283
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  58. 12
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  59. 6
      src/Sophia_Script_for_Windows_11/Functions.ps1
  60. 1
      src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1
  61. 1
      src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1
  62. 1
      src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1
  63. 1
      src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1
  64. 1
      src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1
  65. 1
      src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1
  66. 1
      src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1
  67. 1
      src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1
  68. 1
      src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1
  69. 1
      src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1
  70. 1
      src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1
  71. 1
      src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1
  72. 2
      src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
  73. 422
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  74. 12
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  75. 6
      src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1
  76. 2
      src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1
  77. 281
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  78. 12
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

24
Download_Sophia.ps1

@ -199,11 +199,16 @@ switch ($Version)
}
}
$SetForegroundWindow = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
# https://github.com/PowerShell/PowerShell/issues/21070
$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 = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
@ -213,14 +218,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @SetForegroundWindow
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Ignore this error message. Open background folder manually."
}
Add-Type @Signature
}
Start-Sleep -Seconds 1

10
README.md

@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
@ -114,10 +114,10 @@
| Version | Marketing name | Build | Editions |
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
### Warning

10
README_de-de.md

@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
@ -114,10 +114,10 @@
| Version | Marketing name | Build | Editions |
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
### Warnung

14
README_uk-ua.md

@ -14,8 +14,8 @@
<a href="https://github.com/farag2/Sophia-Script-for-Windows/actions"><img src="https://img.shields.io/github/actions/workflow/status/farag2/Sophia-Script-for-Windows/Sophia.yml?label=GitHub%20Actions&logo=GitHub"></a>
<img src="https://img.shields.io/badge/PowerShell%205.1%20&%207.3-Ready-blue.svg?color=5391FE&style=flat&logo=powershell">
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/v/release/farag2/Sophia-Script-for-Windows">
</a><a href="https://github.com/farag2/Sophia-Script-for-Windows"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/farag2/9852d6b9569a91bf69ceba8a94cc97f4/raw/SophiaScript.json"></a>
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/v/release/farag2/Sophia-Script-for-Windows"></a>
<a href="https://github.com/farag2/Sophia-Script-for-Windows"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/farag2/9852d6b9569a91bf69ceba8a94cc97f4/raw/SophiaScript.json"></a>
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/downloads/farag2/Sophia-Script-for-Windows/total?label=downloads%20%28since%20May%202020%29"></a>
<a href="https://community.chocolatey.org/packages/sophia"><img src="https://img.shields.io/chocolatey/dt/sophia?color=blue&label=chocolatey%20package"></a>
@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
@ -114,10 +114,10 @@
| Версія | Маркетингова назва | Збіркa | Видання |
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
### Увага

BIN
Wrapper/SophiaScriptWrapper.exe

Binary file not shown.

14
sophia_script_versions.json

@ -1,9 +1,9 @@
{
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.3",
"Sophia_Script_Windows_10_PowerShell_7": "5.18.3",
"Sophia_Script_Windows_10_LTSC2019": "5.8.3",
"Sophia_Script_Windows_10_LTSC2021": "5.18.3",
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.3",
"Sophia_Script_Windows_11_PowerShell_7": "6.6.3",
"Sophia_Script_Wrapper": "2.6.20"
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.4",
"Sophia_Script_Windows_10_PowerShell_7": "5.18.4",
"Sophia_Script_Windows_10_LTSC2019": "5.8.4",
"Sophia_Script_Windows_10_LTSC2021": "5.18.4",
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.4",
"Sophia_Script_Windows_11_PowerShell_7": "6.6.4",
"Sophia_Script_Wrapper": "2.7.0"
}

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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.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.3 | 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.4 | 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

1
src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows.
UnsupportedOSBuild = Das Skript unterstützt Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 kompiliert keinen Code, wenn der Benutzername nicht-lateinische Zeichen (einschließlich Emoji) enthält und in Kleinbuchstaben geschrieben ist. Bitte verwenden Sie PowerShell 7.
UpdateWarning = Ihr Windows 10-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.

1
src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = The script supports 64-bit Windows only.
UnsupportedOSBuild = The script supports Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Please, use PowerShell 7.
UpdateWarning = Your Windows 10 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.

1
src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits.
UnsupportedOSBuild = El script es compatible con versión Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 no compila código si el nombre de usuario contiene caracteres no latinos (incluidos los emoji) y está escrito en minúsculas. Por favor, utiliza PowerShell 7.
UpdateWarning = Su build de Windows 10: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.

1
src/Sophia_Script_for_Windows_10/Localizations/fr-FR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Le script n'est compatible qu'avec Windows 64 bits.
UnsupportedOSBuild = Le script supporte les versions Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 ne compile pas le code si le nom d'utilisateur contient des caractères non latins (y compris emoji) et est écrit en minuscules. Veuillez utiliser PowerShell 7.
UpdateWarning = Votre version de Windows 10: {0}.{1}. Versions prises en charge: {2}+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.

1
src/Sophia_Script_for_Windows_10/Localizations/hu-HU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = A szkript csak a 64 bites Windows-t támogatja.
UnsupportedOSBuild = A szkript támogatja a Windows 10 22H2 verzióját.
NonLatinUsernameWarning = A PowerShell 5.1 nem fordít kódot, ha a felhasználónév nem latin betűket tartalmaz (beleértve az emojikat is), és kisbetűvel van írva. Kérjük, használja a PowerShell 7-et.
UpdateWarning = Az Ön Windows 10 építése: {0}.{1}. Támogatott buildek: {2}+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.

1
src/Sophia_Script_for_Windows_10/Localizations/it-IT/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Lo script supporta solo Windows a 64 bit.
UnsupportedOSBuild = Lo script supporta Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 non compila il codice se il nome utente contiene caratteri non latini (compresi gli emoji) ed è scritto in minuscolo. Si prega di utilizzare PowerShell 7.
UpdateWarning = La tua build di Windows 10 {0}.{1} non è supportata. Build supportate: {2}+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.

1
src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows.
UnsupportedOSBuild = Skrypt obsługuje system Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 nie kompiluje kodu, jeśli nazwa użytkownika zawiera znaki spoza alfabetu łacińskiego (w tym emoji) i jest zapisana małymi literami. Prosimy o używanie PowerShell 7.
UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2}+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.

1
src/Sophia_Script_for_Windows_10/Localizations/pt-BR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = O guião suporta apenas Windows de 64 bits.
UnsupportedOSBuild = O script suporta versões Windows 10 22H2.
NonLatinUsernameWarning = O PowerShell 5.1 não compilará o código se o nome de usuário contiver caracteres não latinos (inclusive emoji) e estiver escrito em letras minúsculas. Por favor, use o PowerShell 7.
UpdateWarning = La tua build di Windows 10: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.

1
src/Sophia_Script_for_Windows_10/Localizations/ru-RU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт поддерживает только 64-битную версию Windows.
UnsupportedOSBuild = Скрипт поддерживает Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 не компилирует код, если имя пользователя содержит нелатинские символы (включая эмодзи) и написано со строчной буквы. Пожалуйста, используйте PowerShell 7.
UpdateWarning = Ваш билд Windows 10: {0}.{1}. Поддерживаемые сборки: {2}+. Запустите обновление Windows и попробуйте заново.
UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме.
LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора.

1
src/Sophia_Script_for_Windows_10/Localizations/tr-TR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Komut dosyası yalnızca 64 bit Windows'u destekler.
UnsupportedOSBuild = Komut dosyası Windows 10 22H2'u destekler.
NonLatinUsernameWarning = PowerShell 5.1, kullanıcı adı Latin olmayan karakterler içeriyorsa (emoji dahil) ve küçük harfle yazılmışsa kodu derlemez. Lütfen PowerShell 7 kullanın.
UpdateWarning = Windows 10 yapınız: {0}.{1}. Desteklenen yapılar: {2}+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.

1
src/Sophia_Script_for_Windows_10/Localizations/uk-UA/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт підтримує тільки 64-розрядну версію Windows.
UnsupportedOSBuild = Скрипт підтримує Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 не компілює код, якщо ім'я користувача містить нелатинські символи (включно з емодзі) і написане з малої літери. Будь ласка, використовуйте PowerShell 7.
UpdateWarning = Ваш білд Windows 10: {0}.{1}. Підтримувані збірки: {2}+. Запустіть Windows Update і повторіть спробу.
UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі.
LoggedInUserNotAdmin = Поточний користувач, що увійшов, не має прав адміністратора.

1
src/Sophia_Script_for_Windows_10/Localizations/zh-CN/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = 该脚本仅支持64位Windows
UnsupportedOSBuild = 该脚本支持Windows 10版本22H2和更高版本
NonLatinUsernameWarning = 如果用户名包含非拉丁字符包括表情符号且以小写字母书写PowerShell 5.1 将无法编译代码请使用 PowerShell 7
UpdateWarning = 您的Windows 10构建: {0}.{1}支持的构建: {2}+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利

2
src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1

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

386
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 10 versions
Version: 22H2
Builds: 19045.4123+
Builds: 19045.4170+
Editions: Home/Pro/Enterprise
Architecture: x64
@ -65,12 +65,18 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -117,31 +123,15 @@ public static string GetIndirectString(string indirectString)
}
if (-not ("WinAPI.GetStrings" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
$Signature = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -153,24 +143,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Detect Windows bitness
@ -178,8 +151,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -189,9 +162,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -205,8 +178,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -216,8 +189,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -227,8 +200,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -276,18 +249,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -306,8 +279,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -329,8 +302,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -341,8 +314,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -352,8 +325,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -371,9 +344,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -384,8 +357,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -401,8 +374,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -412,8 +385,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -428,8 +401,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -533,8 +506,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -569,9 +542,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -593,9 +566,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -607,9 +580,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -675,9 +648,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -702,7 +675,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -984,9 +957,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1187,8 +1160,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1600,7 +1573,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1612,7 +1585,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -4611,8 +4584,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -4665,6 +4645,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -4730,8 +4712,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -4784,6 +4773,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -4831,10 +4822,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -5068,10 +5060,11 @@ function OneDrive
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Script:Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -5580,10 +5573,11 @@ function TempFolder
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -5703,10 +5697,11 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -6263,7 +6258,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -7254,19 +7249,20 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@
@ -7368,11 +7364,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -9129,11 +9125,12 @@ function Set-Association
#region functions
$Signature = @{
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -9599,10 +9596,11 @@ public static int UnloadHive(RegistryHives hive, string subKey)
)
$Signature = @{
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
if (sz < 2 || (sz & 1) == 1)
@ -9719,7 +9717,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -9844,10 +9842,11 @@ public static long MakeLong(uint left, uint right)
# Refresh the desktop icons
$Signature = @{
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -12736,11 +12735,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -12748,7 +12751,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -12798,11 +12801,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12865,7 +12872,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -13115,11 +13122,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -13182,7 +13193,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -13421,11 +13432,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -13488,7 +13503,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -15338,11 +15353,12 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
MemberDefinition = @"
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
private const int SMTO_ABORTIFHUNG = 0x0002;
@ -15385,7 +15401,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 10 versions
Version: 22H2
Builds: 19045.4123+
Builds: 19045.4170+
Editions: Home/Pro/Enterprise
Architecture: x64
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.3 | 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.4 | 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
@ -84,8 +84,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

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.3
Date: 01.04.2024
Version: v5.8.4
Date: 07.04.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.3 | 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.4 | 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

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/de-DE/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows.
UnsupportedOSBuild = Das Skript unterstützt Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 kompiliert keinen Code, wenn der Benutzername nicht-lateinische Zeichen (einschließlich Emoji) enthält und in Kleinbuchstaben geschrieben ist. Bitte verwenden Sie PowerShell 7.
UpdateWarning = Ihr Windows 10-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/en-US/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = The script supports 64-bit Windows only.
UnsupportedOSBuild = The script supports Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Please, use PowerShell 7.
UpdateWarning = Your Windows 10 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/es-ES/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits.
UnsupportedOSBuild = El script es compatible con versión Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 no compila código si el nombre de usuario contiene caracteres no latinos (incluidos los emoji) y está escrito en minúsculas. Por favor, utiliza PowerShell 7.
UpdateWarning = Su build de Windows 10: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/fr-FR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Le script n'est compatible qu'avec Windows 64 bits.
UnsupportedOSBuild = Le script supporte le version Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 ne compile pas le code si le nom d'utilisateur contient des caractères non latins (y compris emoji) et est écrit en minuscules. Veuillez utiliser PowerShell 7.
UpdateWarning = Votre version de Windows 10: {0}.{1}. Versions prises en charge: {2}+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/hu-HU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = A szkript csak a 64 bites Windows-t támogatja.
UnsupportedOSBuild = A szkript támogatja a Windows 10 Enterprise LTSC 2019 kiadást.
NonLatinUsernameWarning = A PowerShell 5.1 nem fordít kódot, ha a felhasználónév nem latin betűket tartalmaz (beleértve az emojikat is), és kisbetűvel van írva. Kérjük, használja a PowerShell 7-et.
UpdateWarning = Az Ön Windows 10 építése: {0}.{1}. Támogatott buildek: {2}+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/it-IT/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Lo script supporta solo Windows a 64 bit.
UnsupportedOSBuild = Lo script supporta Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 non compila il codice se il nome utente contiene caratteri non latini (compresi gli emoji) ed è scritto in minuscolo. Si prega di utilizzare PowerShell 7.
UpdateWarning = La tua build di Windows 10 {0}.{1} non è supportata. Build supportate: {2}+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows.
UnsupportedOSBuild = Skrypt obsługuje system Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 nie kompiluje kodu, jeśli nazwa użytkownika zawiera znaki spoza alfabetu łacińskiego (w tym emoji) i jest zapisana małymi literami. Prosimy o używanie PowerShell 7.
UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2}+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pt-BR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = O guião suporta apenas Windows de 64 bits.
UnsupportedOSBuild = O script suporta versões Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = O PowerShell 5.1 não compilará o código se o nome de usuário contiver caracteres não latinos (inclusive emoji) e estiver escrito em letras minúsculas. Por favor, use o PowerShell 7.
UpdateWarning = La tua build di Windows 10: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/ru-RU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт поддерживает только 64-битную версию Windows.
UnsupportedOSBuild = Скрипт поддерживает только Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 не компилирует код, если имя пользователя содержит нелатинские символы (включая эмодзи) и написано со строчной буквы. Пожалуйста, используйте PowerShell 7.
UpdateWarning = Ваш билд Windows 10: {0}.{1}. Поддерживаемые сборки: {2}+. Запустите обновление Windows и попробуйте заново.
UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме.
LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/tr-TR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Komut dosyası yalnızca 64 bit Windows'u destekler.
UnsupportedOSBuild = Komut dosyası Windows 10 Enterprise LTSC 2019'u destekler.
NonLatinUsernameWarning = PowerShell 5.1, kullanıcı adı Latin olmayan karakterler içeriyorsa (emoji dahil) ve küçük harfle yazılmışsa kodu derlemez. Lütfen PowerShell 7 kullanın.
UpdateWarning = Windows 10 yapınız: {0}.{1}. Desteklenen yapılar: {2}+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/uk-UA/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт підтримує тільки 64-розрядну версію Windows.
UnsupportedOSBuild = Скрипт підтримує тільки Windows 10 Enterprise LTSC 2019.
NonLatinUsernameWarning = PowerShell 5.1 не компілює код, якщо ім'я користувача містить нелатинські символи (включно з емодзі) і написане з малої літери. Будь ласка, використовуйте PowerShell 7.
UpdateWarning = Ваш білд Windows 10: {0}.{1}. Підтримувані збірки: {2}+. Запустіть Windows Update і повторіть спробу.
UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі.
LoggedInUserNotAdmin = Поточний користувач, що увійшов, не має прав адміністратора.

1
src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/zh-CN/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = 该脚本仅支持64位Windows
UnsupportedOSBuild = 该脚本支持Windows 10版本Enterprise LTSC 2019
NonLatinUsernameWarning = 如果用户名包含非拉丁字符包括表情符号且以小写字母书写PowerShell 5.1 将无法编译代码请使用 PowerShell 7
UpdateWarning = 您的Windows 10构建: {0}.{1}支持的构建: {2}+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利

2
src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1

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

375
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.3
Date: 01.04.2024
Version: v5.8.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 10 version
Version: 1809
Build: 17763.5458+
Build: 17763.5579+
Edition: Enterprise LTSC
Architecture: x64
@ -65,12 +65,18 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -117,31 +123,15 @@ public static string GetIndirectString(string indirectString)
}
if (-not ("WinAPI.GetStrings" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
$Signature = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -153,24 +143,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Detect Windows bitness
@ -178,8 +151,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -189,9 +162,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -205,8 +178,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -216,8 +189,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -227,8 +200,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -276,18 +249,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -306,8 +279,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -330,8 +303,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -349,9 +322,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -362,8 +335,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -379,8 +352,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -390,8 +363,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -406,8 +379,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -499,8 +472,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -535,9 +508,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -559,9 +532,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -571,9 +544,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
}
@ -584,9 +557,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -649,9 +622,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -673,7 +646,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -955,9 +928,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1155,8 +1128,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1558,7 +1531,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1570,7 +1543,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -3635,8 +3608,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -3689,6 +3669,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -3754,8 +3736,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -3808,6 +3797,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -3855,10 +3846,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -4305,10 +4297,11 @@ function TempFolder
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -4428,10 +4421,11 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -4987,7 +4981,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -5963,19 +5957,20 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@
@ -6077,11 +6072,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -7490,11 +7485,12 @@ function Set-Association
#region functions
$Signature = @{
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -7960,10 +7956,11 @@ public static int UnloadHive(RegistryHives hive, string subKey)
)
$Signature = @{
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
if (sz < 2 || (sz & 1) == 1)
@ -8080,7 +8077,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -8205,10 +8202,11 @@ public static long MakeLong(uint left, uint right)
# Refresh the desktop icons
$Signature = @{
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -9348,11 +9346,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -9360,7 +9362,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -9410,11 +9412,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -9477,7 +9483,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -9727,11 +9733,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -9794,7 +9804,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -10033,11 +10043,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -10100,7 +10114,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -11892,11 +11906,12 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
MemberDefinition = @"
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
private const int SMTO_ABORTIFHUNG = 0x0002;
@ -11939,7 +11954,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v5.8.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 10 version
Version: 1809
Build: 17763.5458+
Build: 17763.5579+
Edition: Enterprise LTSC 2019
Architecture: x64
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.8.3 | 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.4 | 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
@ -84,8 +84,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.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.3 | 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.4 | 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

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/de-DE/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows.
UnsupportedOSBuild = Das Skript unterstützt Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 kompiliert keinen Code, wenn der Benutzername nicht-lateinische Zeichen (einschließlich Emoji) enthält und in Kleinbuchstaben geschrieben ist. Bitte verwenden Sie PowerShell 7.
UpdateWarning = Ihr Windows 10-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/en-US/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = The script supports 64-bit Windows only.
UnsupportedOSBuild = The script supports Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Please, use PowerShell 7.
UpdateWarning = Your Windows 10 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/es-ES/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits.
UnsupportedOSBuild = El script es compatible con versión Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 no compila código si el nombre de usuario contiene caracteres no latinos (incluidos los emoji) y está escrito en minúsculas. Por favor, utiliza PowerShell 7.
UpdateWarning = Su build de Windows 10: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/fr-FR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Le script n'est compatible qu'avec Windows 64 bits.
UnsupportedOSBuild = Le script supporte les versions Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 ne compile pas le code si le nom d'utilisateur contient des caractères non latins (y compris emoji) et est écrit en minuscules. Veuillez utiliser PowerShell 7.
UpdateWarning = Votre version de Windows 10: {0}.{1}. Versions prises en charge: {2}+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/hu-HU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = A szkript csak a 64 bites Windows-t támogatja.
UnsupportedOSBuild = A szkript támogatja a Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = A PowerShell 5.1 nem fordít kódot, ha a felhasználónév nem latin betűket tartalmaz (beleértve az emojikat is), és kisbetűvel van írva. Kérjük, használja a PowerShell 7-et.
UpdateWarning = Az Ön Windows 10 építése: {0}.{1}. Támogatott buildek: {2}+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/it-IT/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Lo script supporta solo Windows a 64 bit.
UnsupportedOSBuild = Lo script supporta Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 non compila il codice se il nome utente contiene caratteri non latini (compresi gli emoji) ed è scritto in minuscolo. Si prega di utilizzare PowerShell 7.
UpdateWarning = La tua build di Windows 10 {0}.{1} non è supportata. Build supportate: {2}+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows.
UnsupportedOSBuild = Skrypt obsługuje system Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 nie kompiluje kodu, jeśli nazwa użytkownika zawiera znaki spoza alfabetu łacińskiego (w tym emoji) i jest zapisana małymi literami. Prosimy o używanie PowerShell 7.
UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2}+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pt-BR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = O guião suporta apenas Windows de 64 bits.
UnsupportedOSBuild = O script suporta versões Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = O PowerShell 5.1 não compilará o código se o nome de usuário contiver caracteres não latinos (inclusive emoji) e estiver escrito em letras minúsculas. Por favor, use o PowerShell 7.
UpdateWarning = La tua build di Windows 10: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/ru-RU/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт поддерживает только 64-битную версию Windows.
UnsupportedOSBuild = Скрипт поддерживает только Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 не компилирует код, если имя пользователя содержит нелатинские символы (включая эмодзи) и написано со строчной буквы. Пожалуйста, используйте PowerShell 7.
UpdateWarning = Ваш билд Windows 10: {0}.{1}. Поддерживаемые сборки: {2}+. Запустите обновление Windows и попробуйте заново.
UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме.
LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/tr-TR/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Komut dosyası yalnızca 64 bit Windows'u destekler.
UnsupportedOSBuild = Komut dosyası Windows 10 Enterprise LTSC 2021'u destekler.
NonLatinUsernameWarning = PowerShell 5.1, kullanıcı adı Latin olmayan karakterler içeriyorsa (emoji dahil) ve küçük harfle yazılmışsa kodu derlemez. Lütfen PowerShell 7 kullanın.
UpdateWarning = Windows 10 yapınız: {0}.{1}. Desteklenen yapılar: {2}+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/uk-UA/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт підтримує тільки 64-розрядну версію Windows.
UnsupportedOSBuild = Скрипт підтримує тільки Windows 10 Enterprise LTSC 2021.
NonLatinUsernameWarning = PowerShell 5.1 не компілює код, якщо ім'я користувача містить нелатинські символи (включно з емодзі) і написане з малої літери. Будь ласка, використовуйте PowerShell 7.
UpdateWarning = Ваш білд Windows 10: {0}.{1}. Підтримувані збірки: {2}+. Запустіть Windows Update і повторіть спробу.
UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі.
LoggedInUserNotAdmin = Поточний користувач, що увійшов, не має прав адміністратора.

1
src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/zh-CN/Sophia.psd1

@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = 该脚本仅支持64位Windows
UnsupportedOSBuild = 该脚本支持Windows 10 Enterprise LTSC 2021
NonLatinUsernameWarning = 如果用户名包含非拉丁字符包括表情符号且以小写字母书写PowerShell 5.1 将无法编译代码请使用 PowerShell 7
UpdateWarning = 您的Windows 10构建: {0}.{1}支持的构建: {2}+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利

2
src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1

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

375
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 10 version
Version: 21H2
Build: 19044.4046+
Build: 19044.4170+
Edition: Enterprise LTSC 2021
Architecture: x64
@ -65,12 +65,18 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -117,31 +123,15 @@ public static string GetIndirectString(string indirectString)
}
if (-not ("WinAPI.GetStrings" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
$Signature = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -153,24 +143,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Detect Windows bitness
@ -178,8 +151,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -189,9 +162,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -205,8 +178,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -216,8 +189,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -227,8 +200,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -276,18 +249,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -306,8 +279,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -330,8 +303,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -349,9 +322,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -362,8 +335,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -379,8 +352,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -390,8 +363,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -406,8 +379,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -499,8 +472,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -535,9 +508,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -559,9 +532,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -571,9 +544,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
}
@ -584,9 +557,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -649,9 +622,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -673,7 +646,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -955,9 +928,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1155,8 +1128,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1558,7 +1531,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1570,7 +1543,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -4007,8 +3980,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -4061,6 +4041,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -4126,8 +4108,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -4180,6 +4169,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -4227,10 +4218,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -4677,10 +4669,11 @@ function TempFolder
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -4800,10 +4793,11 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -5360,7 +5354,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -6351,19 +6345,20 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@
@ -6465,11 +6460,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -8117,11 +8112,12 @@ function Set-Association
#region functions
$Signature = @{
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -8587,10 +8583,11 @@ public static int UnloadHive(RegistryHives hive, string subKey)
)
$Signature = @{
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
if (sz < 2 || (sz & 1) == 1)
@ -8707,7 +8704,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -8832,10 +8829,11 @@ public static long MakeLong(uint left, uint right)
# Refresh the desktop icons
$Signature = @{
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -10479,11 +10477,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -10491,7 +10493,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -10541,11 +10543,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -10608,7 +10614,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -10858,11 +10864,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -10925,7 +10935,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -11164,11 +11174,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -11231,7 +11245,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -13083,11 +13097,12 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
MemberDefinition = @"
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
private const int SMTO_ABORTIFHUNG = 0x0002;
@ -13130,7 +13145,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 10 version
Version: 21H2
Build: 19044.4046+
Build: 19044.4170+
Edition: Enterprise LTSC 2021
Architecture: x64
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.18.3 | 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.4 | 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
@ -84,8 +84,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.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.3 (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.4 (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.3'
ModuleVersion = '5.18.4'
GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

283
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 10 versions
Version: 22H2
Builds: 19045.4123+
Builds: 19045.4170+
Editions: Home/Pro/Enterprise
Architecture: x64
@ -61,11 +61,17 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -120,6 +126,7 @@ public static string GetIndirectString(string indirectString)
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -132,24 +139,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Detect Windows bitness
@ -157,8 +147,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -168,9 +158,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -184,8 +174,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -195,8 +185,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -206,8 +196,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -255,18 +245,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -285,8 +275,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -310,8 +300,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -322,8 +312,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -333,8 +323,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -352,9 +342,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -365,8 +355,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -382,8 +372,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -393,8 +383,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -409,8 +399,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -514,8 +504,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -550,9 +540,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -579,9 +569,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -593,9 +583,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -661,9 +651,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -688,7 +678,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -973,9 +963,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1176,8 +1166,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1589,7 +1579,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1601,7 +1591,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -4600,8 +4590,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -4654,6 +4651,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -4719,8 +4718,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -4773,6 +4779,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -4820,10 +4828,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -5060,6 +5069,7 @@ function OneDrive
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -5572,6 +5582,7 @@ function TempFolder
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -5695,6 +5706,7 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -6252,7 +6264,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -7243,18 +7255,19 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
@ -7357,11 +7370,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -9122,6 +9135,7 @@ function Set-Association
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -9591,6 +9605,7 @@ public static int UnloadHive(RegistryHives hive, string subKey)
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
@ -9708,7 +9723,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -9836,6 +9851,7 @@ public static long MakeLong(uint left, uint right)
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -12745,11 +12761,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -12757,7 +12777,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -12807,11 +12827,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12874,7 +12898,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -13124,11 +13148,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -13191,7 +13219,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -13430,11 +13458,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -13497,7 +13529,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -15347,10 +15379,11 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
@ -15394,7 +15427,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v5.18.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 10 versions
Version: 22H2
Builds: 19045.4123+
Builds: 19045.4170+
Editions: Home/Pro/Enterprise
Architecture: x64
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.3 (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.4 (PowerShell 7) | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
# PowerShell 7 doesn't load en-us localization automatically if there is no localization folder in user's language which is determined by $PSUICulture
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-localizeddata?view=powershell-7.3
@ -93,8 +93,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.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.3 | 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.4 | 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

1
src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Das Skript unterstützt Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 kompiliert keinen Code, wenn der Benutzername nicht-lateinische Zeichen (einschließlich Emoji) enthält und in Kleinbuchstaben geschrieben ist. Bitte verwenden Sie PowerShell 7.
UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.

1
src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = The script supports Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Please, use PowerShell 7.
UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.

1
src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = El script es compatible con Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 no compila código si el nombre de usuario contiene caracteres no latinos (incluidos los emoji) y está escrito en minúsculas. Por favor, utiliza PowerShell 7.
UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.

1
src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Le script prend en charge Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 ne compile pas le code si le nom d'utilisateur contient des caractères non latins (y compris emoji) et est écrit en minuscules. Veuillez utiliser PowerShell 7.
UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: {2}+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.

1
src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2+ rendszert.
NonLatinUsernameWarning = A PowerShell 5.1 nem fordít kódot, ha a felhasználónév nem latin betűket tartalmaz (beleértve az emojikat is), és kisbetűvel van írva. Kérjük, használja a PowerShell 7-et.
UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: {2}+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.

1
src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Lo script supporta Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 non compila il codice se il nome utente contiene caratteri non latini (compresi gli emoji) ed è scritto in minuscolo. Si prega di utilizzare PowerShell 7.
UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: {2}+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.

1
src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Skrypt obsługuje system Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 nie kompiluje kodu, jeśli nazwa użytkownika zawiera znaki spoza alfabetu łacińskiego (w tym emoji) i jest zapisana małymi literami. Prosimy o używanie PowerShell 7.
UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: {2}+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.

1
src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = O script suporta Windows 11 23H2+.
NonLatinUsernameWarning = O PowerShell 5.1 não compilará o código se o nome de usuário contiver caracteres não latinos (inclusive emoji) e estiver escrito em letras minúsculas. Por favor, use o PowerShell 7.
UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.

1
src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Скрипт поддерживает Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 не компилирует код, если имя пользователя содержит нелатинские символы (включая эмодзи) и написано со строчной буквы. Пожалуйста, используйте PowerShell 7.
UpdateWarning = Ваш билд Windows 11: {0}.{1}. Поддерживаемые сборки: {2}+. Запустите обновление Windows и попробуйте заново.
UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме.
LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора.

1
src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Komut dosyası Windows 11 23H2+' destekler.
NonLatinUsernameWarning = PowerShell 5.1, kullanıcı adı Latin olmayan karakterler içeriyorsa (emoji dahil) ve küçük harfle yazılmışsa kodu derlemez. Lütfen PowerShell 7 kullanın.
UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: {2}+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.

1
src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Скрипт підтримує Windows 11 23H2+.
NonLatinUsernameWarning = PowerShell 5.1 не компілює код, якщо ім'я користувача містить нелатинські символи (включно з емодзі) і написане з малої літери. Будь ласка, використовуйте PowerShell 7.
UpdateWarning = Ваш білд Windows 11: {0}.{1}. Підтримувані збірки: {2}+. Запустіть Windows Update і повторіть спробу.
UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі.
LoggedInUserNotAdmin = Поточний користувач, що увійшов, не має прав адміністратора.

1
src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1

@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = 脚本支持Windows 11 23H2+
NonLatinUsernameWarning = 如果用户名包含非拉丁字符包括表情符号且以小写字母书写PowerShell 5.1 将无法编译代码请使用 PowerShell 7
UpdateWarning = 您的Windows 11构建: {0}.{1}支持的构建: {2}+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利

2
src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1

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

422
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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 11 versions
Version: 23H2+
Builds: 22631.3235+
Builds: 22631.3296+
Editions: Home/Pro/Enterprise
.LINK GitHub
@ -64,12 +64,18 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -116,31 +122,15 @@ public static string GetIndirectString(string indirectString)
}
if (-not ("WinAPI.GetStrings" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
$Signature = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -152,24 +142,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Check the language mode
@ -177,9 +150,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -193,8 +166,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -204,8 +177,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -215,8 +188,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -264,18 +237,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -294,8 +267,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -317,8 +290,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -329,8 +302,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -340,8 +313,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -359,9 +332,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -372,8 +345,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -389,8 +362,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -400,8 +373,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -416,8 +389,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -509,8 +482,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -545,9 +518,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -569,9 +542,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -583,9 +556,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -627,33 +600,6 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
UseBasicParsing = $true
}
$LatestSupportedBuild = (Invoke-RestMethod @Parameters).Windows_11
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt $LatestSupportedBuild)
{
# Check Windows minor build version
# https://support.microsoft.com/en-us/topic/windows-11-version-23h2-update-history-59875222-b990-4bd9-932f-91a5954de434
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
}
catch [System.Net.WebException]
{
@ -663,9 +609,39 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
catch [System.ComponentModel.Win32Exception]
{
$LatestSupportedBuild = 0
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
}
# We may use Test-Path -Path variable:LatestSupportedBuild
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt $LatestSupportedBuild)
{
# Check Windows minor build version
# https://support.microsoft.com/en-us/topic/windows-11-version-23h2-update-history-59875222-b990-4bd9-932f-91a5954de434
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
}
}
@ -675,7 +651,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -957,9 +933,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1160,8 +1136,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1579,7 +1555,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1591,7 +1567,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -4209,8 +4185,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -4263,6 +4246,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -4328,8 +4313,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -4382,6 +4374,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -4429,10 +4423,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -5178,10 +5173,11 @@ function TempFolder
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -5301,10 +5297,11 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# The system does not move the file until the operating system is restarted
# The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
@ -5861,7 +5858,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -7054,18 +7051,19 @@ function Set-UserShellFolderLocation
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
"@
@ -7167,11 +7165,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -8724,11 +8722,12 @@ function Set-Association
#region functions
$Signature = @{
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -9194,10 +9193,11 @@ public static int UnloadHive(RegistryHives hive, string subKey)
)
$Signature = @{
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
if (sz < 2 || (sz & 1) == 1)
@ -9314,7 +9314,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -9439,10 +9439,11 @@ public static long MakeLong(uint left, uint right)
# Refresh the desktop icons
$Signature = @{
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -12068,11 +12069,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -12080,7 +12085,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -12130,11 +12135,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12197,7 +12206,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -12447,11 +12456,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12514,7 +12527,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -12753,11 +12766,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12820,7 +12837,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -14891,11 +14908,12 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
MemberDefinition = @"
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
private const int SMTO_ABORTIFHUNG = 0x0002;
@ -14938,7 +14956,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 11 versions
Version: 23H2+
Builds: 22631.3235+
Builds: 22631.3296+
Editions: Home/Pro/Enterprise
.NOTES
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.3 | 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.4 | 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
@ -83,8 +83,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.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.3 | 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.4 | 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.3'
ModuleVersion = '6.6.4'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2024 farag, Inestic & lowl1f3. All rights reserved'

281
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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -12,7 +12,7 @@
.NOTES
Supported Windows 11 versions
Version: 23H2+
Builds: 22631.3235+
Builds: 22631.3296+
Editions: Home/Pro/Enterprise
.LINK GitHub
@ -60,11 +60,17 @@ function InitialActions
# Extract strings from %SystemRoot%\System32\shell32.dll using its' number
# https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
# [WinAPI.GetStrings]::GetIndirectString("@%SystemRoot%\system32\schedsvc.dll,-100")
# https://github.com/PowerShell/PowerShell/issues/21070
$Script:CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$Script:CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$Script:CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "GetStrings"
Language = "CSharp"
UsingNamespace = "System.Text"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -119,6 +125,7 @@ public static string GetIndirectString(string indirectString)
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -131,24 +138,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @Signature
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NonLatinUsernameWarning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/releases/latest"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://github.com/PowerShell/PowerShell/issues/21070"
exit
}
Add-Type @Signature
}
# Check the language mode
@ -156,9 +146,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedLanguageMode
Start-Process -FilePath "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_modes" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -172,8 +162,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.LoggedInUserNotAdmin
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -183,8 +173,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedPowerShell -f $PSVersionTable.PSVersion.Major, $PSVersionTable.PSVersion.Minor)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -194,8 +184,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.UnsupportedHost -f $Host.Name.Replace("Host", ""))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -243,18 +233,18 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Win10TweakerWarning
Start-Process -FilePath "https://youtu.be/na93MS-1EkM"
Start-Process -FilePath "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://youtu.be/na93MS-1EkM" -Verbose
Write-Verbose -Message "https://pikabu.ru/story/byekdor_v_win_10_tweaker_ili_sovremennyie_metodyi_borbyi_s_piratstvom_8227558" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -273,8 +263,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.TweakerWarning -f $Tweaker)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -298,8 +288,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Windows Feature Experience Pack")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -310,8 +300,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
# Extract the localized "Event Viewer" string from shell32.dll
Write-Warning -Message ($Localization.WindowsComponentBroken -f $([WinAPI.GetStrings]::GetString(22029)))
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -321,8 +311,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -340,9 +330,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f $File)
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -353,8 +343,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -370,8 +360,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -381,8 +371,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -397,8 +387,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -490,8 +480,8 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -526,9 +516,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedRelease
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -555,9 +545,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.Bin
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -569,9 +559,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -637,9 +627,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR, $LatestSupportedBuild)
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
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
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
@ -664,7 +654,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Get-Service -Name SysMain | Set-Service -StartupType Automatic
Get-Service -Name SysMain | Start-Service
Start-Process -FilePath "https://www.outsidethebox.ms/19318/"
Write-Verbose -Message "https://www.outsidethebox.ms/19318/" -Verbose
}
# Automatically manage paging file size for all drives
@ -946,9 +936,9 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1149,8 +1139,8 @@ function DiagTrackService
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message ($Localization.InitialActionsCheckFailed -f $PresetName) -Verbose
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
@ -1568,7 +1558,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Disable-ScheduledTask
}
@ -1580,7 +1570,7 @@ function ScheduledTasks
[void]$Window.Close()
$SelectedTasks | ForEach-Object -Process {Write-Verbose $_.TaskName -Verbose}
$SelectedTasks | ForEach-Object -Process {Write-Verbose -Message $_.TaskName -Verbose}
$SelectedTasks | Enable-ScheduledTask
}
@ -4198,8 +4188,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_dark_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_dark_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursors Dark Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_dark_v2.2\working.ani" -Force
@ -4252,6 +4249,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursors Dark Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\dark.zip" -Force
}
catch [System.Net.WebException]
@ -4317,8 +4316,15 @@ function Cursors
New-Item -Path "$env:SystemRoot\Cursors\W11_light_v2.2" -ItemType Directory -Force
}
# Extract archive
Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\light.zip`" -C `"$env:SystemRoot\Cursors\W11_light_v2.2`" -v"
# Extract archive. We cannot call tar.exe due to it fails to extract files if username has cyrillic first letter in lowercase
# Start-Process -FilePath "$env:SystemRoot\System32\tar.exe" -ArgumentList "-xf `"$DownloadsFolder\dark.zip`" -C `"$env:SystemRoot\Cursors\W11_dark_v2.2`" -v"
# https://github.com/PowerShell/PowerShell/issues/21070
Add-Type -Assembly System.IO.Compression.FileSystem
$ZIP = [IO.Compression.ZipFile]::OpenRead("C:\Users\тест\Downloads\dark.zip")
$ZIP.Entries | ForEach-Object -Process {
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$env:SystemRoot\Cursors\W11_light_v2.2\$($_.Name)", $true)
}
$ZIP.Dispose()
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light Free v2.2 by Jepri Creations" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name AppStarting -PropertyType ExpandString -Value "%SystemRoot%\Cursors\W11_light_v2.2\working.ani" -Force
@ -4371,6 +4377,8 @@ function Cursors
) -join ","
New-ItemProperty -Path "HKCU:\Control Panel\Cursors\Schemes" -Name "W11 Cursor Light Free v2.2 by Jepri Creations" -PropertyType String -Value $Schemes -Force
Start-Sleep -Seconds 1
Remove-Item -Path "$DownloadsFolder\light.zip" -Force
}
catch [System.Net.WebException]
@ -4418,10 +4426,11 @@ function Cursors
# Reload cursor on-the-fly
$Signature = @{
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
MemberDefinition = @"
Namespace = "WinAPI"
Name = "Cursor"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint pvParam, uint fWinIni);
"@
@ -4658,6 +4667,7 @@ function OneDrive
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -5170,6 +5180,7 @@ function TempFolder
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -5293,6 +5304,7 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
Namespace = "WinAPI"
Name = "DeleteFiles"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public enum MoveFileFlags
{
@ -5850,7 +5862,7 @@ function WindowsFeatures
[void]$Window.Close()
$SelectedFeatures | ForEach-Object -Process {Write-Verbose $_.DisplayName -Verbose}
$SelectedFeatures | ForEach-Object -Process {Write-Verbose -Message $_.DisplayName -Verbose}
$SelectedFeatures | Disable-WindowsOptionalFeature -Online -NoRestart
}
@ -7042,18 +7054,19 @@ function Set-UserShellFolderLocation
)
$KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641")
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756")
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5404642af1e4")
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d")
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639")
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95")
}
$Signature = @{
Namespace = "WinAPI"
Name = "KnownFolders"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
@ -7156,11 +7169,11 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
{
"Root"
{
# Store all fixed disks' letters to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-7.0#fields
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {$_.DriveType -eq 3}).DeviceID | Sort-Object)
# Store all fixed disks' letters except C (system drive) to use them within Show-Menu function
# https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype
$DriveLetters = @((Get-CimInstance -ClassName CIM_LogicalDisk | Where-Object -FilterScript {($_.DriveType -eq 3) -and ($_.Name -ne $env:SystemDrive)}).DeviceID | Sort-Object)
if ($DriveLetters.Count -eq 1)
if (-not $DriveLetters)
{
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.UserFolderLocationMove -Verbose
@ -8717,6 +8730,7 @@ function Set-Association
Name = "Action"
Language = "CSharp"
UsingNamespace = "System.Text", "System.Security.AccessControl", "Microsoft.Win32"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("advapi32.dll", CharSet = CharSet.Auto)]
private static extern int RegOpenKeyEx(UIntPtr hKey, string subKey, int ulOptions, int samDesired, out UIntPtr hkResult);
@ -9186,6 +9200,7 @@ public static int UnloadHive(RegistryHives hive, string subKey)
Namespace = "WinAPI"
Name = "PatentHash"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
public static uint[] WordSwap(byte[] a, int sz, byte[] md5)
{
@ -9303,7 +9318,7 @@ public static long MakeLong(uint left, uint right)
"@
}
if ( -not ("WinAPI.PatentHash" -as [type]))
if (-not ("WinAPI.PatentHash" -as [type]))
{
Add-Type @Signature
}
@ -9431,6 +9446,7 @@ public static long MakeLong(uint left, uint right)
Namespace = "WinAPI"
Name = "Signature"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -12077,11 +12093,15 @@ while (`$true)
[int]`$CurrentMainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
if (`$SourceMainWindowHandle -ne `$CurrentMainWindowHandle)
{
`$ShowWindowAsync = @{
Namespace = """WinAPI"""
Name = """Win32ShowWindowAsync"""
Language = """CSharp"""
MemberDefinition = @"""
`$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);
"""@
@ -12089,7 +12109,7 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
if (-not ("""WinAPI.Win32ShowWindowAsync""" -as [type]))
{
Add-Type @ShowWindowAsync
Add-Type @Signature
}
`$MainWindowHandle = (Get-Process -Name cleanmgr | Where-Object -FilterScript {`$_.PriorityClass -eq """BelowNormal"""}).MainWindowHandle
[WinAPI.Win32ShowWindowAsync]::ShowWindowAsync(`$MainWindowHandle, 2)
@ -12139,11 +12159,15 @@ public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12206,7 +12230,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
@ -12456,11 +12480,15 @@ function SoftwareDistributionTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12523,7 +12551,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -12762,11 +12790,15 @@ function TempTask
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
# https://redplait.blogspot.com/2018/07/wnf-ids-from-perfntcdll-adk-version.html
`$Focus = @{
Namespace = "WinAPI"
Name = "Focus"
Language = "CSharp"
MemberDefinition = @""
`$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 = "Focus"
Language = "CSharp"
CompilerParameters = `$CompilerParameters
MemberDefinition = @""
[DllImport("NtDll.dll", SetLastError = true)]
private static extern uint NtQueryWnfStateData(IntPtr pStateName, IntPtr pTypeId, IntPtr pExplicitScope, out uint nChangeStamp, out IntPtr pBuffer, ref uint nBufferSize);
@ -12829,7 +12861,7 @@ public static FocusAssistState GetFocusAssistState()
if (-not ("WinAPI.Focus" -as [type]))
{
Add-Type @Focus
Add-Type @Signature
}
# Wait until it will be "OFF" (0)
@ -14567,6 +14599,8 @@ function OpenWindowsTerminalContext
return
}
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked" -Name "{9F156763-7844-4DC4-B2B1-901F640F5155}" -Force -ErrorAction Ignore
switch ($PSCmdlet.ParameterSetName)
{
"Show"
@ -14898,10 +14932,11 @@ function UpdateLGPEPolicies
function PostActions
{
#region Refresh Environment
$UpdateEnvironment = @{
$Signature = @{
Namespace = "WinAPI"
Name = "UpdateEnvironment"
Language = "CSharp"
CompilerOptions = $CompilerParameters
MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a;
@ -14945,7 +14980,7 @@ public static void PostMessage()
}
if (-not ("WinAPI.UpdateEnvironment" -as [type]))
{
Add-Type @UpdateEnvironment
Add-Type @Signature
}
# Simulate pressing F5 to refresh the desktop

12
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.3
Date: 01.04.2024
Version: v6.6.4
Date: 07.04.2024
Copyright (c) 20142024 farag, Inestic & lowl1f3
@ -26,7 +26,7 @@
.NOTES
Supported Windows 11 versions
Version: 23H2+
Builds: 22631.3235+
Builds: 22631.3296+
Editions: Home/Pro/Enterprise
.NOTES
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.3 (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.4 (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
@ -94,8 +94,8 @@ catch [System.InvalidOperationException]
{
Write-Warning -Message $Localization.PowerShellx86Warning
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}

Loading…
Cancel
Save