diff --git a/Download_Sophia.ps1 b/Download_Sophia.ps1
index 0c41f78b..89c0c4bc 100644
--- a/Download_Sophia.ps1
+++ b/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
diff --git a/README.md b/README.md
index 143cb198..1f1a4016 100644
--- a/README.md
+++ b/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
diff --git a/README_de-de.md b/README_de-de.md
index 7d78c42d..feb59a92 100644
--- a/README_de-de.md
+++ b/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
diff --git a/README_uk-ua.md b/README_uk-ua.md
index f05ad57e..d55d80c1 100644
--- a/README_uk-ua.md
+++ b/README_uk-ua.md
@@ -14,8 +14,8 @@
-
-
+
+
@@ -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 |
### Увага
diff --git a/Wrapper/SophiaScriptWrapper.exe b/Wrapper/SophiaScriptWrapper.exe
index 1d95ac7a..fc8fc412 100644
Binary files a/Wrapper/SophiaScriptWrapper.exe and b/Wrapper/SophiaScriptWrapper.exe differ
diff --git a/sophia_script_versions.json b/sophia_script_versions.json
index 5c0962f8..069ebf45 100644
--- a/sophia_script_versions.json
+++ b/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"
}
diff --git a/src/Sophia_Script_for_Windows_10/Functions.ps1 b/src/Sophia_Script_for_Windows_10/Functions.ps1
index 7de5d5ec..5e9dfea9 100644
--- a/src/Sophia_Script_for_Windows_10/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1
index 33fb2a86..52c12353 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1
index 2bbb4ef6..07ecd635 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1
index da4f308b..5465afae 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/fr-FR/Sophia.psd1
index cff456de..3dbb5973 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/fr-FR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/hu-HU/Sophia.psd1
index 594ba0e5..4f18f28a 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/hu-HU/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/it-IT/Sophia.psd1
index 1d31c0f7..ba556a1b 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/it-IT/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1
index 37fe3225..ccb63236 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/pl-PL/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/pt-BR/Sophia.psd1
index f331647e..9474f2c4 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/pt-BR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/ru-RU/Sophia.psd1
index 690dd5d2..dc8c6f3a 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/ru-RU/Sophia.psd1
+++ b/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 = Текущий вошедший пользователь не обладает правами администратора.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/tr-TR/Sophia.psd1
index a63851d8..ee691332 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/tr-TR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/uk-UA/Sophia.psd1
index 25bf4062..6bbba916 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/uk-UA/Sophia.psd1
+++ b/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 = Поточний користувач, що увійшов, не має прав адміністратора.
diff --git a/src/Sophia_Script_for_Windows_10/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Localizations/zh-CN/Sophia.psd1
index 4a7db466..9f972ac2 100644
--- a/src/Sophia_Script_for_Windows_10/Localizations/zh-CN/Sophia.psd1
+++ b/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 = 登录的用户没有管理员的权利。
diff --git a/src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
index 441d5ffe..d79baf86 100644
--- a/src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
index 544b2e53..5ac1f12d 100644
--- a/src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10/Sophia.ps1 b/src/Sophia_Script_for_Windows_10/Sophia.ps1
index 03cd15ed..622a0877 100644
--- a/src/Sophia_Script_for_Windows_10/Sophia.ps1
+++ b/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) 2014—2024 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
}
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
index 70369e72..168e17b7 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/de-DE/Sophia.psd1
index 58b3030e..d1d57981 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/de-DE/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/en-US/Sophia.psd1
index 01537193..002224b6 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/en-US/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/es-ES/Sophia.psd1
index 11417a65..5fb8e5fb 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/es-ES/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/fr-FR/Sophia.psd1
index 792ec9e1..505fc4b3 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/fr-FR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/hu-HU/Sophia.psd1
index a867b836..50817dfe 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/hu-HU/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/it-IT/Sophia.psd1
index af15b35b..b1c5484d 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/it-IT/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1
index c1ffcd2e..d207a587 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pl-PL/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pt-BR/Sophia.psd1
index ce004b47..754dae31 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/pt-BR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/ru-RU/Sophia.psd1
index 02957670..c1ab3dd0 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/ru-RU/Sophia.psd1
+++ b/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 = Текущий вошедший пользователь не обладает правами администратора.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/tr-TR/Sophia.psd1
index 71a6f039..92b2adb2 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/tr-TR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/uk-UA/Sophia.psd1
index 97e24d41..012092ba 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/uk-UA/Sophia.psd1
+++ b/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 = Поточний користувач, що увійшов, не має прав адміністратора.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/zh-CN/Sophia.psd1
index 09ffdbcd..aede0876 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Localizations/zh-CN/Sophia.psd1
+++ b/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 = 登录的用户没有管理员的权利。
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
index 134f6ea5..37ce0957 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
index 3a3fa508..95525516 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
index 462a0071..844d5a57 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
+++ b/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) 2014—2024 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
}
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
index 1dd2a54e..da304501 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/de-DE/Sophia.psd1
index b464dd5f..4a7ea595 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/de-DE/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/en-US/Sophia.psd1
index e84b5563..065074b8 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/en-US/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/es-ES/Sophia.psd1
index c77d14aa..59568106 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/es-ES/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/fr-FR/Sophia.psd1
index 7cd7db5f..a03bba79 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/fr-FR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/hu-HU/Sophia.psd1
index 313ff930..2d92027c 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/hu-HU/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/it-IT/Sophia.psd1
index a4b265e9..419869f6 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/it-IT/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1
index efe81f4f..39529c8f 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pl-PL/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pt-BR/Sophia.psd1
index 0bc17227..655579f9 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/pt-BR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/ru-RU/Sophia.psd1
index f9bf6628..cd3a8553 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/ru-RU/Sophia.psd1
+++ b/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 = Текущий вошедший пользователь не обладает правами администратора.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/tr-TR/Sophia.psd1
index a5204873..c1a6b856 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/tr-TR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/uk-UA/Sophia.psd1
index e2be4634..4d8c3499 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/uk-UA/Sophia.psd1
+++ b/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 = Поточний користувач, що увійшов, не має прав адміністратора.
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/zh-CN/Sophia.psd1
index 86d52b02..a6dfca7a 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Localizations/zh-CN/Sophia.psd1
+++ b/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 = 登录的用户没有管理员的权利。
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
index 441d5ffe..d79baf86 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
index b6552a17..34cabf45 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
index 99f43617..4deab719 100644
--- a/src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
+++ b/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) 2014—2024 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
}
diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
index 439e6019..b2c9b001 100644
--- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
index f744ace0..a85e52dc 100644
--- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
index 65aa030f..e6ce1102 100644
--- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
index b74a87ee..fdbeddf7 100644
--- a/src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
+++ b/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) 2014—2024 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
}
diff --git a/src/Sophia_Script_for_Windows_11/Functions.ps1 b/src/Sophia_Script_for_Windows_11/Functions.ps1
index f9a5e934..108171e3 100644
--- a/src/Sophia_Script_for_Windows_11/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1
index 51e91695..8d94e82c 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1
index fa4695b0..0823caca 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1
index ce977cd2..d9cfaee4 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1
index 3c6e9891..5dc0d7bb 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1
index c43eb290..19330030 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1
index 5a0c45db..234e7f7c 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1
index 5918410c..f70585f6 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1
index f75fbde2..00d9b0b9 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1
+++ b/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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1
index 96942f6f..5c212fee 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1
+++ b/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 = Текущий вошедший пользователь не обладает правами администратора.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1
index 4ae098be..9c340970 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1
+++ b/src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1
@@ -1,6 +1,5 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Komut dosyası Windows 11 23H2+'yı 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.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1
index 3987a49b..cebb4bae 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1
+++ b/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 = Поточний користувач, що увійшов, не має прав адміністратора.
diff --git a/src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1
index 4420ccba..e524d7ae 100644
--- a/src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1
+++ b/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 = 登录的用户没有管理员的权利。
diff --git a/src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
index de0fc6f7..90225711 100644
--- a/src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
index 5723fc97..cf8aa54a 100644
--- a/src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_11/Sophia.ps1 b/src/Sophia_Script_for_Windows_11/Sophia.ps1
index a87c8d5d..fa683694 100644
--- a/src/Sophia_Script_for_Windows_11/Sophia.ps1
+++ b/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) 2014—2024 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
}
diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1
index 6b86c839..dbeae26b 100644
--- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1
index 5f37849d..f68dd59f 100644
--- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1
+++ b/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'
diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
index 65206079..29742945 100644
--- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
+++ b/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) 2014—2024 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
diff --git a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1 b/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1
index aa4e528b..3ca48837 100644
--- a/src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1
+++ b/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) 2014—2024 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
}