Browse Source

19.09.2021 v5.12.3

pull/252/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
606dc308ac
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Sophia/PowerShell 7/Functions.ps1
  2. 3
      Sophia/PowerShell 7/Localizations/de-DE/Sophia.psd1
  3. 1
      Sophia/PowerShell 7/Localizations/en-US/Sophia.psd1
  4. 1
      Sophia/PowerShell 7/Localizations/es-ES/Sophia.psd1
  5. 1
      Sophia/PowerShell 7/Localizations/fr-FR/Sophia.psd1
  6. 1
      Sophia/PowerShell 7/Localizations/hu-HU/Sophia.psd1
  7. 1
      Sophia/PowerShell 7/Localizations/it-IT/Sophia.psd1
  8. 1
      Sophia/PowerShell 7/Localizations/pt-BR/Sophia.psd1
  9. 1
      Sophia/PowerShell 7/Localizations/ru-RU/Sophia.psd1
  10. 1
      Sophia/PowerShell 7/Localizations/tr-TR/Sophia.psd1
  11. 1
      Sophia/PowerShell 7/Localizations/uk-UA/Sophia.psd1
  12. 1
      Sophia/PowerShell 7/Localizations/zh-CN/Sophia.psd1
  13. 2
      Sophia/PowerShell 7/Manifest/Sophia.psd1
  14. 357
      Sophia/PowerShell 7/Module/Sophia.psm1
  15. 23
      Sophia/PowerShell 7/Sophia.ps1

6
Sophia/PowerShell 7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v5.12.2 Version: v5.12.3
Date: 25.08.2021 Date: 19.09.2021
Copyright (c) 20142021 farag Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & Inestic Copyright (c) 20192021 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.2 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.3 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

3
Sophia/PowerShell 7/Localizations/de-DE/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine A
UnsupportedPowerShell = Sie versuchen, ein Skript über PowerShell {0}.{1} auszuführen. Führen Sie das Skript in der entsprechenden PowerShell-Version aus UnsupportedPowerShell = Sie versuchen, ein Skript über PowerShell {0}.{1} auszuführen. Führen Sie das Skript in der entsprechenden PowerShell-Version aus
UnsupportedISE = Das Skript unterstützt nicht die Ausführung über Windows PowerShell ISE UnsupportedISE = Das Skript unterstützt nicht die Ausführung über Windows PowerShell ISE
Win10TweakerWarning = Wahrscheinlich wurde Ihr Betriebssystem über die Win 10 Tweaker-Hintertür infiziert Win10TweakerWarning = Wahrscheinlich wurde Ihr Betriebssystem über die Win 10 Tweaker-Hintertür infiziert
PowerShellLibraries = Im Ordner "Libraries" befinden sich keine Dateien. Bitte laden Sie das Archiv erneut herunter
UnsupportedRelease = Neue Version gefunden UnsupportedRelease = Neue Version gefunden
CustomizationWarning = \nHaben Sie alle Funktionen in der voreingestellten Datei Sophia.ps1 angepasst, bevor Sie Sophia Script ausführen? CustomizationWarning = \nHaben Sie alle Funktionen in der voreingestellten Datei Sophia.ps1 angepasst, bevor Sie Sophia Script ausführen?
ControlledFolderAccessDisabled = Kontrollierter Ordnerzugriff deaktiviert ControlledFolderAccessDisabled = Kontrollierter Ordnerzugriff deaktiviert
@ -49,7 +50,7 @@ ErrorsFile = Datei
ErrorsMessage = Fehler/Warnungen ErrorsMessage = Fehler/Warnungen
Add = Hinzufügen Add = Hinzufügen
AllFilesFilter = Alle Dateien (*.*)|*.* AllFilesFilter = Alle Dateien (*.*)|*.*
Browse = Durchsuchen Browse = Durchsuche
Change = Ändern Change = Ändern
DialogBoxOpening = Anzeigen des Dialogfensters... DialogBoxOpening = Anzeigen des Dialogfensters...
Disable = Deaktivieren Disable = Deaktivieren

1
Sophia/PowerShell 7/Localizations/en-US/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = The logged-on user doesn't have admi
UnsupportedPowerShell = You're trying to run script via PowerShell {0}.{1}. Run the script in the appropriate PowerShell version UnsupportedPowerShell = You're trying to run script via PowerShell {0}.{1}. Run the script in the appropriate PowerShell version
UnsupportedISE = The script doesn't support running via Windows PowerShell ISE UnsupportedISE = The script doesn't support running via Windows PowerShell ISE
Win10TweakerWarning = Probably your OS was infected via the Win 10 Tweaker backdoor Win10TweakerWarning = Probably your OS was infected via the Win 10 Tweaker backdoor
PowerShellLibraries = There are no files in the Libraries folder. Please, re-download the archive
UnsupportedRelease = A new version found UnsupportedRelease = A new version found
CustomizationWarning = \nHave you customized every function in the Sophia.ps1 preset file before running Sophia Script? CustomizationWarning = \nHave you customized every function in the Sophia.ps1 preset file before running Sophia Script?
ControlledFolderAccessDisabled = Controlled folder access disabled ControlledFolderAccessDisabled = Controlled folder access disabled

1
Sophia/PowerShell 7/Localizations/es-ES/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = El usuario que inició sesión no ti
UnsupportedPowerShell = Estás intentando ejecutar el script a través de PowerShell {0}.{1}. Ejecute el script en la versión apropiada de PowerShell UnsupportedPowerShell = Estás intentando ejecutar el script a través de PowerShell {0}.{1}. Ejecute el script en la versión apropiada de PowerShell
UnsupportedISE = El script no es compatible con la ejecución a través de Windows PowerShell ISE UnsupportedISE = El script no es compatible con la ejecución a través de Windows PowerShell ISE
Win10TweakerWarning = Probablemente su sistema operativo fue infectado a través del backdoor Win 10 Tweaker Win10TweakerWarning = Probablemente su sistema operativo fue infectado a través del backdoor Win 10 Tweaker
PowerShellLibraries = No hay archivos en la carpeta Bibliotecas. Por favor, vuelva a descargar el archivo
UnsupportedRelease = Una nueva versión encontrada UnsupportedRelease = Una nueva versión encontrada
CustomizationWarning = \n¿Ha personalizado todas las funciones del archivo predeterminado Sophia.ps1 antes de ejecutar Sophia Script? CustomizationWarning = \n¿Ha personalizado todas las funciones del archivo predeterminado Sophia.ps1 antes de ejecutar Sophia Script?
ControlledFolderAccessDisabled = Acceso a la carpeta controlada deshabilitado ControlledFolderAccessDisabled = Acceso a la carpeta controlada deshabilitado

1
Sophia/PowerShell 7/Localizations/fr-FR/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de d
UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell UnsupportedPowerShell = Vous essayez d'exécuter le script via PowerShell {0}.{1}. Exécutez le script dans la version appropriée de PowerShell
UnsupportedISE = Le script ne supporte pas l'exécution via Windows PowerShell ISE UnsupportedISE = Le script ne supporte pas l'exécution via Windows PowerShell ISE
Win10TweakerWarning = Votre système d'exploitation a probablement été infecté par la porte dérobée Win 10 Tweaker Win10TweakerWarning = Votre système d'exploitation a probablement été infecté par la porte dérobée Win 10 Tweaker
PowerShellLibraries = Il n'y a pas de fichiers dans le dossier Bibliothèques. Veuillez retélécharger l'archive
UnsupportedRelease = Nouvelle version trouvée UnsupportedRelease = Nouvelle version trouvée
CustomizationWarning = \nAvez-vous personnalisé chaque fonction du fichier de préréglage Sophia.ps1 avant d'exécuter Sophia Script? CustomizationWarning = \nAvez-vous personnalisé chaque fonction du fichier de préréglage Sophia.ps1 avant d'exécuter Sophia Script?
ControlledFolderAccessDisabled = Contrôle d'accès aux dossiers désactivé ControlledFolderAccessDisabled = Contrôle d'accès aux dossiers désactivé

1
Sophia/PowerShell 7/Localizations/hu-HU/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = A bejelentkezett felhasználó nem r
UnsupportedPowerShell = A PowerShell {0}.{1} segítségével próbálja futtatni a szkriptet. Futtassa a szkriptet a megfelelő PowerShell-verzióban UnsupportedPowerShell = A PowerShell {0}.{1} segítségével próbálja futtatni a szkriptet. Futtassa a szkriptet a megfelelő PowerShell-verzióban
UnsupportedISE = A szkript nem támogatja a Windows PowerShell ISE futtatását UnsupportedISE = A szkript nem támogatja a Windows PowerShell ISE futtatását
Win10TweakerWarning = Valószínűleg az operációs rendszerét a Win 10 Tweaker backdoor segítségével fertőzték meg Win10TweakerWarning = Valószínűleg az operációs rendszerét a Win 10 Tweaker backdoor segítségével fertőzték meg
PowerShellLibraries = A Libraries mappában nincsenek fájlok. Kérjük, töltse le újra az archívumot
UnsupportedRelease = Új verzió érhető el UnsupportedRelease = Új verzió érhető el
CustomizationWarning = \nSzemélyre szabott minden opciót a Sophia.ps1 preset fájlban, mielőtt futtatni kívánja a Sophia szkriptet? CustomizationWarning = \nSzemélyre szabott minden opciót a Sophia.ps1 preset fájlban, mielőtt futtatni kívánja a Sophia szkriptet?
ControlledFolderAccessDisabled = Vezérelt mappához való hozzáférés kikapcsolva ControlledFolderAccessDisabled = Vezérelt mappához való hozzáférés kikapcsolva

1
Sophia/PowerShell 7/Localizations/it-IT/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = L'utente connesso non ha i diritti d
UnsupportedPowerShell = Stai cercando di eseguire lo script tramite PowerShell {0}.{1}. Esegui lo script nella versione di PowerShell appropriata UnsupportedPowerShell = Stai cercando di eseguire lo script tramite PowerShell {0}.{1}. Esegui lo script nella versione di PowerShell appropriata
UnsupportedISE = Lo script non supporta l'esecuzione tramite Windows PowerShell ISE UnsupportedISE = Lo script non supporta l'esecuzione tramite Windows PowerShell ISE
Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker
PowerShellLibraries = Non ci sono file nella cartella Libraries. Per favore, scarica di nuovo l'archivio
UnsupportedRelease = Nuova versione trovata UnsupportedRelease = Nuova versione trovata
CustomizationWarning = \nSono state personalizzate tutte le funzioni nel file delle preimpostazioni Sophia.ps1 prima di eseguire Sophia Script? CustomizationWarning = \nSono state personalizzate tutte le funzioni nel file delle preimpostazioni Sophia.ps1 prima di eseguire Sophia Script?
ControlledFolderAccessDisabled = l'accesso alle cartelle controllata disattivata ControlledFolderAccessDisabled = l'accesso alle cartelle controllata disattivata

1
Sophia/PowerShell 7/Localizations/pt-BR/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = O usuário logado não tem direitos
UnsupportedPowerShell = Você está tentando executar o script via PowerShell {0}.{1}. Execute o script na versão apropriada do PowerShell UnsupportedPowerShell = Você está tentando executar o script via PowerShell {0}.{1}. Execute o script na versão apropriada do PowerShell
UnsupportedISE = O guião não suporta a execução através do Windows PowerShell ISE UnsupportedISE = O guião não suporta a execução através do Windows PowerShell ISE
Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker Win10TweakerWarning = Probabilmente il tuo sistema operativo è stato infettato tramite la backdoor Win 10 Tweaker
PowerShellLibraries = Não existem ficheiros na pasta Bibliotecas. Por favor, volte a descarregar o arquivo
UnsupportedRelease = Nova versão encontrada UnsupportedRelease = Nova versão encontrada
CustomizationWarning = \nVocê personalizou todas as funções no arquivo de predefinição Sophia.ps1 antes de executar o Sophia Script? CustomizationWarning = \nVocê personalizou todas as funções no arquivo de predefinição Sophia.ps1 antes de executar o Sophia Script?
ControlledFolderAccessDisabled = Acesso controlado a pasta desativada ControlledFolderAccessDisabled = Acesso controlado a pasta desativada

1
Sophia/PowerShell 7/Localizations/ru-RU/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = Текущий вошедший по
UnsupportedPowerShell = Вы пытаетесь запустить скрипт в PowerShell {0}.{1}. Запустите скрипт в соответствующей версии PowerShell UnsupportedPowerShell = Вы пытаетесь запустить скрипт в PowerShell {0}.{1}. Запустите скрипт в соответствующей версии PowerShell
UnsupportedISE = Скрипт не поддерживает работу через Windows PowerShell ISE UnsupportedISE = Скрипт не поддерживает работу через Windows PowerShell ISE
Win10TweakerWarning = Ваша ОС, возможно, через бэкдор в Win 10 Tweaker была заражена трояном Win10TweakerWarning = Ваша ОС, возможно, через бэкдор в Win 10 Tweaker была заражена трояном
PowerShellLibraries = В папке Libraries отсутствутствуют файлы. Пожалуйста, перекачайте архив
UnsupportedRelease = Обнаружена новая версия UnsupportedRelease = Обнаружена новая версия
CustomizationWarning = \nВы настроили все функции в пресет-файле Sophia.ps1 перед запуском Sophia Script? CustomizationWarning = \nВы настроили все функции в пресет-файле Sophia.ps1 перед запуском Sophia Script?
ControlledFolderAccessDisabled = Контролируемый доступ к папкам выключен ControlledFolderAccessDisabled = Контролируемый доступ к папкам выключен

1
Sophia/PowerShell 7/Localizations/tr-TR/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = Oturum açan kullanıcının yöneti
UnsupportedPowerShell = Komut dosyasını PowerShell {0}.{1} aracılığıyla çalıştırmaya çalışıyorsunuz. Komut dosyasını uygun PowerShell sürümünde çalıştırın UnsupportedPowerShell = Komut dosyasını PowerShell {0}.{1} aracılığıyla çalıştırmaya çalışıyorsunuz. Komut dosyasını uygun PowerShell sürümünde çalıştırın
UnsupportedISE = Komut dosyası, Windows PowerShell ISE üzerinden çalıştırmayı desteklemiyor UnsupportedISE = Komut dosyası, Windows PowerShell ISE üzerinden çalıştırmayı desteklemiyor
Win10TweakerWarning = Muhtemelen işletim sisteminize Win 10 Tweaker arka kapısı yoluyla bulaştı Win10TweakerWarning = Muhtemelen işletim sisteminize Win 10 Tweaker arka kapısı yoluyla bulaştı
PowerShellLibraries = Kitaplıklar klasöründe dosya yok. Lütfen arşivi yeniden indirin
UnsupportedRelease = Yeni sürüm bulundu UnsupportedRelease = Yeni sürüm bulundu
CustomizationWarning = \nSophia Script'i çalıştırmadan önce Sophia.ps1 ön ayar dosyasındaki her işlevi özelleştirdiniz mi? CustomizationWarning = \nSophia Script'i çalıştırmadan önce Sophia.ps1 ön ayar dosyasındaki her işlevi özelleştirdiniz mi?
ControlledFolderAccessDisabled = Kontrollü klasör erişimi devre dışı bırakıldı ControlledFolderAccessDisabled = Kontrollü klasör erişimi devre dışı bırakıldı

1
Sophia/PowerShell 7/Localizations/uk-UA/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = Поточний увійшов ко
UnsupportedPowerShell = Ви намагаєтеся запустити скрипт в PowerShell {0}.{1}. Запустіть скрипт у відповідній версії PowerShell UnsupportedPowerShell = Ви намагаєтеся запустити скрипт в PowerShell {0}.{1}. Запустіть скрипт у відповідній версії PowerShell
UnsupportedISE = Скрипт не підтримує роботу через Windows PowerShell ISE UnsupportedISE = Скрипт не підтримує роботу через Windows PowerShell ISE
Win10TweakerWarning = Ваша ОС, можливо, через бекдор в Win 10 Tweaker заражена трояном Win10TweakerWarning = Ваша ОС, можливо, через бекдор в Win 10 Tweaker заражена трояном
PowerShellLibraries = У папці «Бібліотеки» немає файлів. Будь ласка, повторно завантажте архів
UnsupportedRelease = Виявлено нову версію UnsupportedRelease = Виявлено нову версію
CustomizationWarning = \nВи налаштували всі функції в пресет-файлі Sophia.ps1 перед запуском Sophia Script? CustomizationWarning = \nВи налаштували всі функції в пресет-файлі Sophia.ps1 перед запуском Sophia Script?
ControlledFolderAccessDisabled = Контрольований доступ до папок вимкнений ControlledFolderAccessDisabled = Контрольований доступ до папок вимкнений

1
Sophia/PowerShell 7/Localizations/zh-CN/Sophia.psd1

@ -7,6 +7,7 @@ LoggedInUserNotAdmin = 登录的用户没有管理员的权
UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本 UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本
UnsupportedISE = 该脚本不支持通过Windows PowerShell ISE运行 UnsupportedISE = 该脚本不支持通过Windows PowerShell ISE运行
Win10TweakerWarning = 可能你的操作系统是通过Win 10 Tweaker后门感染的 Win10TweakerWarning = 可能你的操作系统是通过Win 10 Tweaker后门感染的
PowerShellLibraries = Libraries文件夹中没有文件请重新下载该档案
UnsupportedRelease = 找到新版本 UnsupportedRelease = 找到新版本
CustomizationWarning = \n在运行Sophia Script之前您是否已自定义Sophia.ps1预设文件中的每个函数 CustomizationWarning = \n在运行Sophia Script之前您是否已自定义Sophia.ps1预设文件中的每个函数
ControlledFolderAccessDisabled = 受控文件夹访问已禁用 ControlledFolderAccessDisabled = 受控文件夹访问已禁用

2
Sophia/PowerShell 7/Manifest/Sophia.psd1

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

357
Sophia/PowerShell 7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.12.2 Version: v5.12.3
Date: 25.08.2021 Date: 19.09.2021
Copyright (c) 20142021 farag Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & Inestic Copyright (c) 20192021 farag & Inestic
@ -31,15 +31,15 @@
https://t.me/sophianews https://t.me/sophianews
https://t.me/sophia_chat https://t.me/sophia_chat
.LINK Authors .NOTES
https://github.com/farag2
https://github.com/Inestic
.LINK
https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15 https://forum.ru-board.com/topic.cgi?forum=62&topic=30617#15
https://habr.com/company/skillfactory/blog/553800/ https://habr.com/company/skillfactory/blog/553800/
https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/ https://forums.mydigitallife.net/threads/powershell-windows-10-sophia-script.81675/
https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/ https://www.reddit.com/r/PowerShell/comments/go2n5v/powershell_script_setup_windows_10/
.LINK Authors
https://github.com/farag2
https://github.com/Inestic
#> #>
#region Checkings #region Checkings
@ -85,10 +85,18 @@ function Checkings
$Version = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR $Version = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $Version) Write-Warning -Message ($Localization.UpdateWarning -f $Version)
# Check for updates # Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate-action" Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 3
Start-Process -FilePath "ms-settings:windowsupdate-optionalupdates" Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit exit
} }
@ -146,13 +154,26 @@ function Checkings
exit exit
} }
# Check whether there are libraries in the Libraries folder
$Libraries = @("$PSScriptRoot\..\Libraries\Microsoft.Windows.SDK.NET.dll", "$PSScriptRoot\..\Libraries\WinRT.Runtime.dll")
if (($Libraries | Test-Path) -contains $false)
{
Write-Warning -Message $Localization.PowerShellLibraries
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows/releases/latest"
exit
}
# Check if the current module version is the latest one # Check if the current module version is the latest one
try try
{ {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json # https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$LatestRelease = (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"-UseBasicParsing).Sophia_Script_Windows_10_PowerShell_7 $LatestRelease = (Invoke-RestMethod -Uri "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json" -UseBasicParsing).Sophia_Script_Windows_10_PowerShell_7
$CurrentRelease = (Get-Module -Name Sophia).Version.ToString() $CurrentRelease = (Get-Module -Name Sophia).Version.ToString()
switch ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease) switch ([System.Version]$LatestRelease -gt [System.Version]$CurrentRelease)
{ {
@ -174,7 +195,7 @@ function Checkings
} }
# Unblock all files in the script folder by removing the Zone.Identifier alternate data stream with a value of "3" # Unblock all files in the script folder by removing the Zone.Identifier alternate data stream with a value of "3"
Get-ChildItem -Path $PSScriptRoot -Recurse -Force | Unblock-File Get-ChildItem -Path $PSScriptRoot\..\ -File -Recurse -Force | Unblock-File
# Display a warning message about whether a user has customized the preset file # Display a warning message about whether a user has customized the preset file
if ($Warning) if ($Warning)
@ -230,12 +251,12 @@ function Checkings
#endregion Checkings #endregion Checkings
#region Protection #region Protection
# Enable script logging. The log will be being recorded into the script folder # Enable script logging. The log will be being recorded into the script root folder
# To stop logging just close the console or type "Stop-Transcript" # To stop logging just close the console or type "Stop-Transcript"
function Logging function Logging
{ {
$TrascriptFilename = "Log-$((Get-Date).ToString("dd.MM.yyyy-HH-mm"))" $TrascriptFilename = "Log-$((Get-Date).ToString("dd.MM.yyyy-HH-mm"))"
Start-Transcript -Path $PSScriptRoot\$TrascriptFilename.txt -Force Start-Transcript -Path $PSScriptRoot\..\$TrascriptFilename.txt -Force
} }
# Create a restore point for the system drive # Create a restore point for the system drive
@ -512,7 +533,7 @@ function FeedbackFrequency
} }
"Automatically" "Automatically"
{ {
Remove-Item -Path HKCU:\SOFTWARE\Microsoft\Siuf\Rules -Force -ErrorAction SilentlyContinue Remove-Item -Path HKCU:\SOFTWARE\Microsoft\Siuf\Rules -Force -ErrorAction Ignore
} }
} }
} }
@ -799,10 +820,13 @@ function ScheduledTasks
if (-not ($Tasks)) if (-not ($Tasks))
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.NoData -Verbose Write-Verbose -Message $Localization.NoData -Verbose
return return
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
#region Sendkey function #region Sendkey function
@ -812,9 +836,9 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -2085,7 +2109,7 @@ function 3DObjects
} }
"Show" "Show"
{ {
Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name ThisPCPolicy -Force -ErrorAction SilentlyContinue Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" -Name ThisPCPolicy -Force -ErrorAction Ignore
} }
} }
@ -2718,9 +2742,9 @@ function UnpinTaskbarShortcuts
# Extract strings from shell32.dll using its' number # Extract strings from shell32.dll using its' number
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "GetStr" Name = "GetStr"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName); public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -2754,9 +2778,8 @@ public static string GetString(uint strId)
if (Test-Path -Path "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk") if (Test-Path -Path "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\Microsoft Edge.lnk")
{ {
# Call the shortcut context menu item # Call the shortcut context menu item
$Shell = New-Object -ComObject Shell.Application $Shell = (New-Object -ComObject Shell.Application).NameSpace("$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")
$Folder = $Shell.NameSpace("$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar") $Shortcut = $Shell.ParseName("Microsoft Edge.lnk")
$Shortcut = $Folder.ParseName("Microsoft Edge.lnk")
$Shortcut.Verbs() | Where-Object -FilterScript {$_.Name -eq $LocalizedString} | ForEach-Object -Process {$_.DoIt()} $Shortcut.Verbs() | Where-Object -FilterScript {$_.Name -eq $LocalizedString} | ForEach-Object -Process {$_.DoIt()}
} }
} }
@ -2836,7 +2859,7 @@ function ControlPanelView
switch ($PSCmdlet.ParameterSetName) switch ($PSCmdlet.ParameterSetName)
{ {
"Category" "Category"
{ {
if (-not (Test-Path -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel)) if (-not (Test-Path -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel))
{ {
@ -3018,11 +3041,7 @@ function NewAppInstalledNotification
} }
"Show" "Show"
{ {
if (-not (Test-Path -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer)) Remove-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoNewAppAlert -Force
{
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Force
}
New-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Explorer -Name NoNewAppAlert -PropertyType DWord -Value 0 -Force
} }
} }
} }
@ -3069,11 +3088,11 @@ function FirstLogonAnimation
{ {
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableFirstLogonAnimation -PropertyType DWord -Value 0 -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name EnableFirstLogonAnimation -PropertyType DWord -Value 0 -Force
} }
"Enable" "Enable"
{ {
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableFirstLogonAnimation -PropertyType DWord -Value 1 -Force New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" -Name EnableFirstLogonAnimation -PropertyType DWord -Value 1 -Force
} }
} }
} }
@ -3514,6 +3533,7 @@ function OneDrive
[string]$UninstallString = $Uninstall.Meta.UninstallString [string]$UninstallString = $Uninstall.Meta.UninstallString
if ($UninstallString) if ($UninstallString)
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveUninstalling -Verbose Write-Verbose -Message $Localization.OneDriveUninstalling -Verbose
Stop-Process -Name OneDrive -Force -ErrorAction Ignore Stop-Process -Name OneDrive -Force -ErrorAction Ignore
@ -3542,9 +3562,9 @@ function OneDrive
# The system does not move the file until the operating system is restarted # 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 # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "DeleteFiles" Name = "DeleteFiles"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
public enum MoveFileFlags public enum MoveFileFlags
{ {
@ -3653,24 +3673,39 @@ public static bool MarkFileDelete (string sourcefile)
{ {
if (Test-Path -Path $env:SystemRoot\SysWOW64\OneDriveSetup.exe) if (Test-Path -Path $env:SystemRoot\SysWOW64\OneDriveSetup.exe)
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveInstalling -Verbose Write-Verbose -Message $Localization.OneDriveInstalling -Verbose
Start-Process -FilePath $env:SystemRoot\SysWOW64\OneDriveSetup.exe Start-Process -FilePath $env:SystemRoot\SysWOW64\OneDriveSetup.exe
} }
else else
{ {
# Downloading the latest OneDrive
try try
{ {
# Downloading the latest OneDrive installer x64
if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription) if ((Invoke-WebRequest -Uri https://www.google.com -UseBasicParsing -DisableKeepAlive -Method Head).StatusDescription)
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.OneDriveDownloading -Verbose Write-Verbose -Message $Localization.OneDriveDownloading -Verbose
# Parse XML to get the URL
# https://go.microsoft.com/fwlink/p/?LinkID=844652
$Parameters = @{
Uri = "https://g.live.com/1rewlive5skydrive/OneDriveProduction"
UseBasicParsing = $true
Verbose = $true
}
$Content = Invoke-RestMethod @Parameters
# Remove invalid chars
[xml]$OneDriveXML = $Content -replace "", ""
$OneDriveURL = ($OneDriveXML).root.update.amd64binary.url[-1]
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = "https://go.microsoft.com/fwlink/p/?LinkID=2121808" Uri = $OneDriveURL
OutFile = "$DownloadsFolder\OneDriveSetup.exe" OutFile = "$DownloadsFolder\OneDriveSetup.exe"
SslProtocol = "Tls12" SslProtocol = "Tls12"
Verbose = [switch]::Present Verbose = $true
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
@ -3930,10 +3965,10 @@ function Hibernation
The %TEMP% environment variable path The %TEMP% environment variable path
.PARAMETER SystemDrive .PARAMETER SystemDrive
Change the %TEMP% environment variable path to "%SystemDrive%\Temp" Change the %TEMP% environment variable path to %SystemDrive%\Temp
.PARAMETER Default .PARAMETER Default
Change the %TEMP% environment variable path to "%LOCALAPPDATA%\Temp" Change the %TEMP% environment variable path to %LOCALAPPDATA%\Temp
.EXAMPLE .EXAMPLE
TempFolder -SystemDrive TempFolder -SystemDrive
@ -4002,9 +4037,9 @@ function TempFolder
# The system does not move the file until the operating system is restarted # 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 # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "DeleteFiles" Name = "DeleteFiles"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
public enum MoveFileFlags public enum MoveFileFlags
{ {
@ -4046,10 +4081,10 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
"@ "@
# Create a temporary scheduled task to create a symbolic link to the %SystemDrive%\Temp folder # Create a temporary scheduled task to create a symbolic link to the %SystemDrive%\Temp folder
$Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $SymbolicLinkTask" $Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $SymbolicLinkTask"
$Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME $Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME
$Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8
$Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest
$Parameters = @{ $Parameters = @{
TaskName = "SymbolicLink" TaskName = "SymbolicLink"
Principal = $Principal Principal = $Principal
@ -4066,7 +4101,7 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
} }
#region main #region main
# Change the %TEMP% environment variable path to "%LOCALAPPDATA%\Temp" # Change the %TEMP% environment variable path to %LOCALAPPDATA%\Temp
[Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "User") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "User")
[Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Machine") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Machine")
[Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Process") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemDrive\Temp", "Process")
@ -4122,9 +4157,9 @@ Unregister-ScheduledTask -TaskName SymbolicLink -Confirm:`$false
# The system does not move the file until the operating system is restarted # 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 # The system moves the file immediately after AUTOCHK is executed, but before creating any paging files
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "DeleteFiles" Name = "DeleteFiles"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
public enum MoveFileFlags public enum MoveFileFlags
{ {
@ -4164,10 +4199,10 @@ Unregister-ScheduledTask -TaskName TemporaryTask -Confirm:`$false
"@ "@
# Create a temporary scheduled task to clean up the temporary folder # Create a temporary scheduled task to clean up the temporary folder
$Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $TempFolderCleanupTask" $Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $TempFolderCleanupTask"
$Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME $Trigger = New-ScheduledTaskTrigger -AtLogon -User $env:USERNAME
$Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8
$Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest
$Parameters = @{ $Parameters = @{
TaskName = "TemporaryTask" TaskName = "TemporaryTask"
Principal = $Principal Principal = $Principal
@ -4179,7 +4214,7 @@ Unregister-ScheduledTask -TaskName TemporaryTask -Confirm:`$false
} }
#region main #region main
# Change the %TEMP% environment variable path to "%LOCALAPPDATA%\Temp" # Change the %TEMP% environment variable path to %LOCALAPPDATA%\Temp
[Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "User") [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "User")
[Environment]::SetEnvironmentVariable("TMP", "$env:SystemRoot\TEMP", "Machine") [Environment]::SetEnvironmentVariable("TMP", "$env:SystemRoot\TEMP", "Machine")
[Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Process") [Environment]::SetEnvironmentVariable("TMP", "$env:LOCALAPPDATA\Temp", "Process")
@ -4397,7 +4432,7 @@ function MappedDrivesAppElevatedAccess
} }
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLinkedConnections -PropertyType DWord -Value 0 -Force Remove-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System -Name EnableLinkedConnections -Force -ErrorAction Ignore
} }
} }
} }
@ -4820,6 +4855,7 @@ function WindowsFeatures
} }
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
# Getting list of all optional features according to the conditions # Getting list of all optional features according to the conditions
@ -4831,10 +4867,13 @@ function WindowsFeatures
if (-not ($Features)) if (-not ($Features))
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.NoData -Verbose Write-Verbose -Message $Localization.NoData -Verbose
return return
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
#region Sendkey function #region Sendkey function
@ -4844,9 +4883,9 @@ function WindowsFeatures
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -5103,6 +5142,7 @@ function WindowsCapabilities
function UninstallButton function UninstallButton
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close() [void]$Window.Close()
@ -5112,12 +5152,14 @@ function WindowsCapabilities
if ([string]$SelectedCapabilities.Name -match "Browser.InternetExplorer") if ([string]$SelectedCapabilities.Name -match "Browser.InternetExplorer")
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.RestartWarning Write-Warning -Message $Localization.RestartWarning
} }
} }
function InstallButton function InstallButton
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
[void]$Window.Close() [void]$Window.Close()
@ -5127,6 +5169,7 @@ function WindowsCapabilities
if ([string]$SelectedCapabilities.Name -match "Browser.InternetExplorer") if ([string]$SelectedCapabilities.Name -match "Browser.InternetExplorer")
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.RestartWarning Write-Warning -Message $Localization.RestartWarning
} }
} }
@ -5204,6 +5247,7 @@ function WindowsCapabilities
} }
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
# Getting list of all capabilities according to the conditions # Getting list of all capabilities according to the conditions
@ -5215,10 +5259,13 @@ function WindowsCapabilities
if (-not ($Capabilities)) if (-not ($Capabilities))
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.NoData -Verbose Write-Verbose -Message $Localization.NoData -Verbose
return return
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
#region Sendkey function #region Sendkey function
@ -5228,9 +5275,9 @@ function WindowsCapabilities
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -5741,18 +5788,18 @@ function SetUserShellFolderLocation
) )
$KnownFolders = @{ $KnownFolders = @{
"Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641"); "Desktop" = @("B4BFCC3A-DB2C-424C-B029-7FE99A87C641");
"Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756"); "Documents" = @("FDD39AD0-238F-46AF-ADB4-6C85480369C7", "f42ee2d3-909f-4907-8871-4c22fc0bf756");
"Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5393042af1e4"); "Downloads" = @("374DE290-123F-4565-9164-39C4925E467B", "7d83ee9b-2244-4e70-b1f5-5393042af1e4");
"Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d"); "Music" = @("4BD8D571-6D19-48D3-BE97-422220080E43", "a0c69a99-21c8-4671-8703-7934162fcf1d");
"Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639"); "Pictures" = @("33E28130-4E1E-4676-835A-98395C3BC3BB", "0ddd015d-b06c-45d5-8c4c-f59713854639");
"Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95"); "Videos" = @("18989B1D-99B5-455B-841C-AB7C74E4DDFC", "35286a68-3c57-41a1-bbb1-0eae73d76c95");
} }
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "KnownFolders" Name = "KnownFolders"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("shell32.dll")] [DllImport("shell32.dll")]
public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path); public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, IntPtr token, [MarshalAs(UnmanagedType.LPWStr)] string path);
@ -5932,9 +5979,9 @@ public extern static int SHSetKnownFolderPath(ref Guid folderId, uint flags, Int
# Get the localized user folders names # Get the localized user folders names
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "GetStr" Name = "GetStr"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName); public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -5968,6 +6015,7 @@ public static string GetString(uint strId)
{ {
"Root" "Root"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose Write-Verbose -Message $Localization.RetrievingDrivesList -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -5991,7 +6039,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6025,7 +6072,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6059,7 +6105,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6093,7 +6138,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6125,8 +6169,8 @@ public static string GetString(uint strId)
$CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures" $CurrentUserFolderLocation = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "My Pictures"
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6160,7 +6204,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6194,7 +6237,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6238,7 +6280,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6282,7 +6323,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6326,7 +6366,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6370,7 +6409,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6414,7 +6452,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6460,7 +6497,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DesktopLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6491,7 +6527,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DocumentsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6522,7 +6557,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $DownloadsLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6553,7 +6587,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $MusicLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6584,7 +6617,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $PicturesLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6615,7 +6647,6 @@ public static string GetString(uint strId)
Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose Write-Verbose -Message ($Localization.CurrentUserFolderLocation -f $VideosLocalizedString, $CurrentUserFolderLocation) -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message $Localization.FilesWontBeMoved Write-Warning -Message $Localization.FilesWontBeMoved
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
@ -6718,14 +6749,14 @@ function WinPrtScrFolder
.SYNOPSIS .SYNOPSIS
Recommended troubleshooter preferences Recommended troubleshooter preferences
.PARAMETER Automatic .PARAMETER Automatically
Run troubleshooter automatically, then notify me Run troubleshooter automatically, then notify me
.PARAMETER Default .PARAMETER Default
Ask me before running troubleshooter Ask me before running troubleshooter
.EXAMPLE .EXAMPLE
RecommendedTroubleshooting -Automatic RecommendedTroubleshooting -Automatically
.EXAMPLE .EXAMPLE
RecommendedTroubleshooting -Default RecommendedTroubleshooting -Default
@ -6742,10 +6773,10 @@ function RecommendedTroubleshooting
( (
[Parameter( [Parameter(
Mandatory = $true, Mandatory = $true,
ParameterSetName = "Automatic" ParameterSetName = "Automatically"
)] )]
[switch] [switch]
$Automatic, $Automatically,
[Parameter( [Parameter(
Mandatory = $true, Mandatory = $true,
@ -6757,7 +6788,7 @@ function RecommendedTroubleshooting
switch ($PSCmdlet.ParameterSetName) switch ($PSCmdlet.ParameterSetName)
{ {
"Automatic" "Automatically"
{ {
if (-not (Test-Path -Path HKLM:\SOFTWARE\Microsoft\WindowsMitigation)) if (-not (Test-Path -Path HKLM:\SOFTWARE\Microsoft\WindowsMitigation))
{ {
@ -6948,7 +6979,7 @@ function F1HelpPage
} }
"Enable" "Enable"
{ {
Remove-Item -Path "HKCU:\SOFTWARE\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}" -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path "HKCU:\SOFTWARE\Classes\Typelib\{8cec5860-07a1-11d9-b15e-000d56bfe6ee}" -Recurse -Force -ErrorAction Ignore
} }
} }
} }
@ -7050,7 +7081,7 @@ function CapsLock
} }
"Enable" "Enable"
{ {
Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -Name "Scancode Map" -Force Remove-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout" -Name "Scancode Map" -Force -ErrorAction Ignore
} }
} }
} }
@ -8048,6 +8079,7 @@ namespace FileAssoc
Set-Icon -ProgId $ProgId -Icon $Icon Set-Icon -ProgId $ProgId -Icon $Icon
} }
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
# Setting additional parameters to comply with the requirements before configuring the extension # Setting additional parameters to comply with the requirements before configuring the extension
@ -8058,9 +8090,9 @@ namespace FileAssoc
# Refresh the desktop icons # Refresh the desktop icons
$UpdateExplorer = @{ $UpdateExplorer = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "UpdateExplorer" Name = "UpdateExplorer"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)] [DllImport("shell32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2); private static extern int SHChangeNotify(int eventId, int flags, IntPtr item1, IntPtr item2);
@ -8226,9 +8258,9 @@ function WSL
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -8512,9 +8544,9 @@ function PinToStart
# Extract strings from shell32.dll using its' number # Extract strings from shell32.dll using its' number
# https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/8#issue-227159084 # https://github.com/Disassembler0/Win10-Initial-Setup-Script/issues/8#issue-227159084
$Signature = @{ $Signature = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "GetStr" Name = "GetStr"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("kernel32.dll", CharSet = CharSet.Auto)] [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr GetModuleHandle(string lpModuleName); public static extern IntPtr GetModuleHandle(string lpModuleName);
@ -8941,6 +8973,7 @@ function UninstallUWPApps
$AllUsers $AllUsers
) )
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
$AppxPackages = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers:$AllUsers | Where-Object -FilterScript {$_.Name -notin $ExcludedAppxPackages} $AppxPackages = Get-AppxPackage -PackageTypeFilter Bundle -AllUsers:$AllUsers | Where-Object -FilterScript {$_.Name -notin $ExcludedAppxPackages}
@ -9028,6 +9061,7 @@ function UninstallUWPApps
function ButtonUninstallClick function ButtonUninstallClick
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
$Window.Close() | Out-Null $Window.Close() | Out-Null
@ -9115,10 +9149,12 @@ function UninstallUWPApps
if ($AppxPackages.Count -eq 0) if ($AppxPackages.Count -eq 0)
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.NoData -Verbose Write-Verbose -Message $Localization.NoData -Verbose
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
#region Sendkey function #region Sendkey function
@ -9128,9 +9164,9 @@ function UninstallUWPApps
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -9209,7 +9245,7 @@ function RestoreUWPApps
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="Window" Name="Window"
MinHeight="400" MinWidth="410" MinHeight="400" MinWidth="410"
SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen" SizeToContent="Width" WindowStartupLocation="CenterScreen"
TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True" TextOptions.TextFormattingMode="Display" SnapsToDevicePixels="True"
FontFamily="Candara" FontSize="16" ShowInTaskbar="True" FontFamily="Candara" FontSize="16" ShowInTaskbar="True"
Background="#F1F1F1" Foreground="#262626"> Background="#F1F1F1" Foreground="#262626">
@ -9286,6 +9322,7 @@ function RestoreUWPApps
#region Functions #region Functions
function Get-AppxManifest function Get-AppxManifest
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
# You cannot retrieve packages using -PackageTypeFilter Bundle, otherwise you won't get the InstallLocation attribute. It can be retrieved only by comparing with $Bundles # You cannot retrieve packages using -PackageTypeFilter Bundle, otherwise you won't get the InstallLocation attribute. It can be retrieved only by comparing with $Bundles
@ -9359,6 +9396,7 @@ function RestoreUWPApps
function ButtonRestoreClick function ButtonRestoreClick
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
$Window.Close() | Out-Null $Window.Close() | Out-Null
@ -9367,8 +9405,8 @@ function RestoreUWPApps
Register = $true Register = $true
ForceApplicationShutdown = $true ForceApplicationShutdown = $true
ForceUpdateFromAnyVersion = $true ForceUpdateFromAnyVersion = $true
DisableDevelopmentMod = $true DisableDevelopmentMode = $true
Verbose = [switch]::Present Verbose = $true
} }
$PackagesToRestore | Add-AppxPackage @Parameters $PackagesToRestore | Add-AppxPackage @Parameters
} }
@ -9441,10 +9479,12 @@ function RestoreUWPApps
if ($AppxPackages.Count -eq 0) if ($AppxPackages.Count -eq 0)
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.NoData -Verbose Write-Verbose -Message $Localization.NoData -Verbose
} }
else else
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.DialogBoxOpening -Verbose Write-Verbose -Message $Localization.DialogBoxOpening -Verbose
#region Sendkey function #region Sendkey function
@ -9454,9 +9494,9 @@ function RestoreUWPApps
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Windows.Forms
$SetForegroundWindow = @{ $SetForegroundWindow = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "ForegroundWindow" Name = "ForegroundWindow"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
[DllImport("user32.dll")] [DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@ -9551,7 +9591,7 @@ function HEIF
"Install" "Install"
{ {
# Check whether the extension is already installed # Check whether the extension is already installed
if (-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension) -and (Get-AppxPackage -Name Microsoft.Windows.Photos)) if ((-not (Get-AppxPackage -Name Microsoft.HEVCVideoExtension)) -and (Get-AppxPackage -Name Microsoft.Windows.Photos))
{ {
try try
{ {
@ -9582,14 +9622,15 @@ function HEIF
if ($Package -like "Microsoft.HEVCVideoExtension_*_x64__8wekyb3d8bbwe.appx") if ($Package -like "Microsoft.HEVCVideoExtension_*_x64__8wekyb3d8bbwe.appx")
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.HEVCDownloading -Verbose Write-Verbose -Message $Localization.HEVCDownloading -Verbose
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}" $DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{ $Parameters = @{
Uri = $TempURL Uri = $TempURL
OutFile = "$DownloadsFolder\$Package" OutFile = "$DownloadsFolder\$Package"
SslProtocol = "Tls12" SslProtocol = "Tls12"
Verbose = [switch]::Present Verbose = $true
} }
Invoke-WebRequest @Parameters Invoke-WebRequest @Parameters
@ -9752,43 +9793,28 @@ function BackgroundUWPApps
{ {
"Disable" "Disable"
{ {
# Remove all excluded apps running in the background
Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process { Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name * -Force Remove-ItemProperty -Path $_.PsPath -Name * -Force
} }
$ExcludedBackgroundApps = @( # Exclude apps from the Bundle only
# Lock screen app $BackgroundAccessApplications = @((Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications).PSChildName)
"Microsoft.LockApp", $ExcludedBackgroundAccessApplications = @()
foreach ($BackgroundAccessApplication in $BackgroundAccessApplications)
# Content Delivery Manager (delivers Windows Spotlight wallpapers to the lock screen) {
"Microsoft.Windows.ContentDeliveryManager", if (Get-AppxPackage -PackageTypeFilter Bundle -AllUsers | Where-Object -FilterScript {$_.PackageFamilyName -eq $BackgroundAccessApplication})
{
# Cortana $ExcludedBackgroundAccessApplications += $BackgroundAccessApplication
"Microsoft.Windows.Cortana", }
}
# Windows Search
"Microsoft.Windows.Search",
# Windows Security
"Microsoft.Windows.SecHealthUI",
# Windows Shell Experience (Action center, snipping support, toast notification, touch screen keyboard)
"Microsoft.Windows.ShellExperienceHost",
# The Start menu
"Microsoft.Windows.StartMenuExperienceHost",
# Microsoft Store Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | Where-Object -FilterScript {$_.PSChildName -in $ExcludedBackgroundAccessApplications} | ForEach-Object -Process {
"Microsoft.WindowsStore"
)
$OFS = "|"
Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications | Where-Object -FilterScript {$_.PSChildName -notmatch "^$($ExcludedBackgroundApps.ForEach({[regex]::Escape($_)}))"} | ForEach-Object -Process {
New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force New-ItemProperty -Path $_.PsPath -Name Disabled -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force New-ItemProperty -Path $_.PsPath -Name DisabledByUser -PropertyType DWord -Value 1 -Force
} }
$OFS = " "
# Open "Background apps" page # Open the "Background apps" page
Start-Process -FilePath ms-settings:privacy-backgroundapps Start-Process -FilePath ms-settings:privacy-backgroundapps
} }
"Enable" "Enable"
@ -9979,6 +10005,7 @@ function SetAppGraphicsPerformance
} }
"1" "1"
{ {
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message $Localization.Skipped -Verbose Write-Verbose -Message $Localization.Skipped -Verbose
} }
} }
@ -10210,9 +10237,9 @@ while (`$true)
"@ "@
# Create the "Windows Cleanup" task # Create the "Windows Cleanup" task
$Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $CleanupTask" $Action = New-ScheduledTaskAction -Execute powershell.exe -Argument "-WindowStyle Hidden -Command $CleanupTask"
$Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable $Settings = New-ScheduledTaskSettingsSet -Compatibility Win8 -StartWhenAvailable
$Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest $Principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -RunLevel Highest
$Parameters = @{ $Parameters = @{
TaskName = "Windows Cleanup" TaskName = "Windows Cleanup"
TaskPath = "Sophia Script" TaskPath = "Sophia Script"
@ -10894,7 +10921,7 @@ function EventViewerCustomView
} }
"Disable" "Disable"
{ {
Remove-Item -Path "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml" -Force -ErrorAction SilentlyContinue Remove-Item -Path "$env:ProgramData\Microsoft\Event Viewer\Views\ProcessCreation.xml" -Force -ErrorAction Ignore
} }
} }
} }
@ -11318,16 +11345,15 @@ function MSIExtractContext
{ {
New-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Force New-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Force
} }
$Value = "{0}" -f 'msiexec.exe /a "%1" /qb TARGETDIR="%1 extracted"' $Value = "{0}" -f "msiexec.exe /a `"%1`" /qb TARGETDIR=`"%1 extracted`""
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Name "(default)" -PropertyType String -Value $Value -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract\Command -Name "(default)" -PropertyType String -Value $Value -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name MUIVerb -PropertyType String -Value "@shell32.dll,-37514" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name MUIVerb -PropertyType String -Value "@shell32.dll,-37514" -Force
New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name Icon -PropertyType String -Value "shell32.dll,-16817" -Force New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Name Icon -PropertyType String -Value "shell32.dll,-16817" -Force
} }
"Hide" "Hide"
{ {
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path Registry::HKEY_CLASSES_ROOT\Msi.Package\shell\Extract -Recurse -Force -ErrorAction Ignore
} }
} }
} }
@ -11384,9 +11410,8 @@ function CABInstallContext
} }
"Hide" "Hide"
{ {
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Recurse -Force -ErrorAction SilentlyContinue Remove-Item -Path Registry::HKEY_CLASSES_ROOT\CABFolder\Shell\RunAs -Recurse -Force -ErrorAction Ignore
} }
} }
} }
@ -11609,7 +11634,7 @@ function EditWithPaint3DContext
$Extensions = @(".bmp", ".gif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff") $Extensions = @(".bmp", ".gif", ".jpe", ".jpeg", ".jpg", ".png", ".tif", ".tiff")
foreach ($Extension in $Extensions) foreach ($Extension in $Extensions)
{ {
Remove-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\$Extension\Shell\3D Edit" -Name ProgrammaticAccessOnly -Force -ErrorAction SilentlyContinue Remove-ItemProperty -Path "Registry::HKEY_CLASSES_ROOT\SystemFileAssociations\$Extension\Shell\3D Edit" -Name ProgrammaticAccessOnly -Force -ErrorAction Ignore
} }
} }
} }
@ -12046,7 +12071,7 @@ function BitmapImageNewContext
{ {
if ((Get-WindowsCapability -Online -Name "Microsoft.Windows.MSPaint*").State -eq "Installed") if ((Get-WindowsCapability -Online -Name "Microsoft.Windows.MSPaint*").State -eq "Installed")
{ {
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp\ShellNew -Force -ErrorAction SilentlyContinue Remove-Item -Path Registry::HKEY_CLASSES_ROOT\.bmp\ShellNew -Force -ErrorAction Ignore
} }
} }
"Show" "Show"
@ -12331,9 +12356,9 @@ function UseStoreOpenWith
function RefreshEnvironment function RefreshEnvironment
{ {
$UpdateEnvironment = @{ $UpdateEnvironment = @{
Namespace = "WinAPI" Namespace = "WinAPI"
Name = "UpdateEnvironment" Name = "UpdateEnvironment"
Language = "CSharp" Language = "CSharp"
MemberDefinition = @" MemberDefinition = @"
private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff); private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
private const int WM_SETTINGCHANGE = 0x1a; private const int WM_SETTINGCHANGE = 0x1a;

23
Sophia/PowerShell 7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10 (PowerShell 7)" Default preset file for "Sophia Script for Windows 10 (PowerShell 7)"
Version: v5.12.2 Version: v5.12.3
Date: 25.08.2021 Date: 19.09.2021
Copyright (c) 20142021 farag Copyright (c) 20142021 farag
Copyright (c) 20192021 farag & Inestic Copyright (c) 20192021 farag & Inestic
@ -21,6 +21,10 @@
.EXAMPLE Run the script by specifying the module functions as an argument .EXAMPLE Run the script by specifying the module functions as an argument
.\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps .\Sophia.ps1 -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
.EXAMPLE Download and expand the archive (without running) the latest Sophia Script according which Windows and PowerShell versions it is run on
irm script.sophi.app | iex
Invoke-RestMethod -Uri script.sophi.app | Invoke-Expression
.NOTES .NOTES
Supported Windows 10 versions Supported Windows 10 versions
Versions: 2004/20H2/21H1/21H2 Versions: 2004/20H2/21H1/21H2
@ -32,9 +36,6 @@
Set execution policy to be able to run scripts only in the current PowerShell session: Set execution policy to be able to run scripts only in the current PowerShell session:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
.NOTES
Running the script is best done on a fresh install because running it on wrong tweaked system may result in errors occurring
.NOTES .NOTES
To use the TAB completion for functions and their arguments dot source the Function.ps1 script first: To use the TAB completion for functions and their arguments dot source the Function.ps1 script first:
. .\Function.ps1 (with a dot at the beginning) . .\Function.ps1 (with a dot at the beginning)
@ -71,7 +72,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.2 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.12.3 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -207,7 +208,7 @@ WindowsWelcomeExperience -Hide
WindowsTips -Enable WindowsTips -Enable
# Do not get tip, trick, and suggestions as you use Windows # Do not get tip, trick, and suggestions as you use Windows
# Не получать советы, подсказки и рекомендации при использованию Windows # Не получать советы, подсказки и рекомендации при использовании Windows
# WindowsTips -Disable # WindowsTips -Disable
# Hide from me suggested content in the Settings app # Hide from me suggested content in the Settings app
@ -537,11 +538,11 @@ AppsLanguageSwitch -Enable
# AppsLanguageSwitch -Disable # AppsLanguageSwitch -Disable
# When I grab a windows's title bar and shake it, minimize all other windows # When I grab a windows's title bar and shake it, minimize all other windows
# При захвате заголовка окна и встряхивании сворачивать все остальные окна # При захвате заголовка окна и встряхивании сворачиваются все остальные окна
AeroShaking -Enable AeroShaking -Enable
# When I grab a windows's title bar and shake it, don't minimize all other windows (default value) # When I grab a windows's title bar and shake it, don't minimize all other windows (default value)
# При захвате заголовка окна и встряхивании не сворачивать все остальные окна (значение по умолчанию) # При захвате заголовка окна и встряхивании не сворачиваются все остальные окна (значение по умолчанию)
# AeroShaking -Disable # AeroShaking -Disable
#endregion UI & Personalization #endregion UI & Personalization
@ -791,7 +792,7 @@ WinPrtScrFolder -Desktop
Автоматически запускать средства устранения неполадок, а затем уведомлять Автоматически запускать средства устранения неполадок, а затем уведомлять
Чтобы заработала данная функция, уровень сбора диагностических данных ОС будет установлен на "Необязательные диагностические данные" и включится создание отчетов об ошибках Windows Чтобы заработала данная функция, уровень сбора диагностических данных ОС будет установлен на "Необязательные диагностические данные" и включится создание отчетов об ошибках Windows
#> #>
RecommendedTroubleshooting -Automatic RecommendedTroubleshooting -Automatically
<# <#
Ask me before running troubleshooter (default value) Ask me before running troubleshooter (default value)
@ -989,7 +990,7 @@ HEIF -Install
Открыть страницу "Расширения для видео HEVC от производителя устройства" в Microsoft Store, чтобы вручную установить расширение для открытия форматов .heic и .heif Открыть страницу "Расширения для видео HEVC от производителя устройства" в Microsoft Store, чтобы вручную установить расширение для открытия форматов .heic и .heif
Расширение может быть установлено бесплатно без учетной записи Microsoft Расширение может быть установлено бесплатно без учетной записи Microsoft
#> #>
# HEIF -Manual # HEIF -Manually
# Disable Cortana autostarting # Disable Cortana autostarting
# Выключить автозагрузку Кортана # Выключить автозагрузку Кортана

Loading…
Cancel
Save