Browse Source

19.09.2021 v5.2.14

pull/252/head
Dmitry Nefedov 3 years ago
committed by GitHub
parent
commit
921aaa4857
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Sophia/LTSC/Localizations/en-US/Sophia.psd1
  2. 2
      Sophia/LTSC/Manifest/Sophia.psd1
  3. 184
      Sophia/LTSC/Module/Sophia.psm1
  4. 13
      Sophia/LTSC/Sophia.ps1

2
Sophia/LTSC/Localizations/en-US/Sophia.psd1

@ -3,7 +3,7 @@ UnsupportedOSBitness = The script supports Windows 10 x64 o
UnsupportedOSBuild = The script supports Windows 10 1809 Enterprise LTSC UnsupportedOSBuild = The script supports Windows 10 1809 Enterprise LTSC
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode UnsupportedLanguageMode = The PowerShell session in running in a limited language mode
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights LoggedInUserNotAdmin = The logged-on user doesn't have admin rights
UnsupportedPowerShell = You're trying to run script via PowerShell {0}.{1}.{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
UnsupportedRelease = A new version found UnsupportedRelease = A new version found

2
Sophia/LTSC/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{ @{
RootModule = '..\Module\Sophia.psm1' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.2.13' ModuleVersion = '5.2.14'
GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01' GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01'
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'

184
Sophia/LTSC/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.2.13 Version: v5.2.14
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
@ -157,7 +157,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)
@ -210,12 +210,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
@ -771,10 +771,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
@ -784,9 +787,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);
@ -1582,7 +1585,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
} }
} }
@ -2059,7 +2062,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))
{ {
@ -2190,11 +2193,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
} }
} }
} }
@ -2241,11 +2240,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
} }
} }
} }
@ -2819,10 +2818,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
@ -2882,9 +2881,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
{ {
@ -2926,10 +2925,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
@ -2946,7 +2945,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")
@ -2993,9 +2992,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
{ {
@ -3035,10 +3034,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
@ -3050,7 +3049,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")
@ -3268,7 +3267,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
} }
} }
} }
@ -3690,6 +3689,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
@ -3701,10 +3701,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
@ -3714,9 +3717,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);
@ -3955,6 +3958,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()
@ -3964,12 +3968,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()
@ -3979,6 +3985,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
} }
} }
@ -4056,6 +4063,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
@ -4067,10 +4075,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
@ -4080,9 +4091,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);
@ -4593,18 +4604,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);
@ -4784,9 +4795,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);
@ -4820,6 +4831,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
@ -4843,7 +4855,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
@ -4877,7 +4888,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
@ -4911,7 +4921,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
@ -4945,7 +4954,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
@ -4977,8 +4985,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
@ -5012,7 +5020,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
@ -5046,7 +5053,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
@ -5090,7 +5096,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
@ -5134,7 +5139,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
@ -5178,7 +5182,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
@ -5222,7 +5225,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
@ -5266,7 +5268,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
@ -5312,7 +5313,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
@ -5343,7 +5343,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
@ -5374,7 +5373,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
@ -5405,7 +5403,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
@ -5436,7 +5433,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
@ -5467,7 +5463,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
@ -5667,7 +5662,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
} }
} }
} }
@ -5769,7 +5764,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
} }
} }
} }
@ -6666,6 +6661,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
@ -6676,9 +6672,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);
@ -7081,9 +7077,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"
@ -7765,7 +7761,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
} }
} }
} }
@ -8189,16 +8185,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
} }
} }
} }
@ -8255,9 +8250,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
} }
} }
} }
@ -8740,7 +8734,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"
@ -9025,9 +9019,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;

13
Sophia/LTSC/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC" Default preset file for "Sophia Script for Windows 10 LTSC"
Version: v5.2.13 Version: v5.2.14
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 version Supported Windows 10 version
Version: 1809 Version: 1809
@ -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 LTSC v5.2.13 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014–2021" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC v5.2.14 | 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

Loading…
Cancel
Save