Browse Source

Code refactoring

pull/619/head
Dmitry Nefedov 2 years ago
parent
commit
43b96b0ed6
  1. 265
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  2. 160
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  3. 160
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  4. 265
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  5. 4
      src/Sophia_Script_for_Windows_11/Localizations/de-DE/Sophia.psd1
  6. 5
      src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1
  7. 4
      src/Sophia_Script_for_Windows_11/Localizations/es-ES/Sophia.psd1
  8. 4
      src/Sophia_Script_for_Windows_11/Localizations/fr-FR/Sophia.psd1
  9. 4
      src/Sophia_Script_for_Windows_11/Localizations/hu-HU/Sophia.psd1
  10. 4
      src/Sophia_Script_for_Windows_11/Localizations/it-IT/Sophia.psd1
  11. 4
      src/Sophia_Script_for_Windows_11/Localizations/pl-PL/Sophia.psd1
  12. 4
      src/Sophia_Script_for_Windows_11/Localizations/pt-BR/Sophia.psd1
  13. 4
      src/Sophia_Script_for_Windows_11/Localizations/ru-RU/Sophia.psd1
  14. 4
      src/Sophia_Script_for_Windows_11/Localizations/tr-TR/Sophia.psd1
  15. 4
      src/Sophia_Script_for_Windows_11/Localizations/uk-UA/Sophia.psd1
  16. 4
      src/Sophia_Script_for_Windows_11/Localizations/zh-CN/Sophia.psd1
  17. 319
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  18. 4
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  19. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1
  20. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1
  21. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1
  22. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1
  23. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1
  24. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1
  25. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1
  26. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1
  27. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1
  28. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1
  29. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1
  30. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1
  31. 247
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  32. 4
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

265
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -167,8 +167,8 @@ public static string GetString(uint strId)
} }
catch [System.Net.WebException] catch [System.Net.WebException]
{ {
Write-Warning -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") Write-Warning -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com") -ErrorAction SilentlyContinue
} }
} }
catch [System.ComponentModel.Win32Exception] catch [System.ComponentModel.Win32Exception]
@ -192,6 +192,16 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{ {
{($_ -lt 19045) -or ($_ -gt 19045)}
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
{$_ -eq 19045} {$_ -eq 19045}
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570)
@ -221,16 +231,6 @@ public static string GetString(uint strId)
exit exit
} }
} }
{($_ -lt 19045) -or ($_ -gt 19045)}
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
} }
# Check the language mode # Check the language mode
@ -310,6 +310,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -390,6 +392,17 @@ public static string GetString(uint strId)
exit exit
} }
# Check if Microsoft Store being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Check if the current module version is the latest one # Check if the current module version is the latest one
try try
{ {
@ -460,57 +473,43 @@ public static string GetString(uint strId)
} }
} }
# The Enterprise G edition doesn't has a built-in Defender # Checking whether Windows Security Settings page was hidden from UI
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{ {
# Checking whether WMI is corrupted Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
try
{
Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null
}
catch [Microsoft.Management.Infrastructure.CimException]
{
# Provider Load Failure exception
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat" Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79" Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit exit
}
} }
# Check Microsoft Defender state # Checking whether WMI is corrupted
# The Enterprise G edition doesn't has a built-in Defender try
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{ {
# Check Microsoft Defender state Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore)) }
{ catch [Microsoft.Management.Infrastructure.CimException]
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") {
# Provider Load Failure exception
Start-Process -FilePath "https://t.me/sophia_chat" Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Start-Process -FilePath "https://discord.gg/sSryhaEv79" Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
exit Start-Process -FilePath "https://t.me/sophia_chat"
} Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Check Microsoft Defender state exit
$productState = (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName Antivirusproduct | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01")
{
$Script:DefenderproductState = $true
}
else
{
$Script:DefenderproductState = $false
}
} }
else
# Check Microsoft Defender state
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{ {
$Script:DefenderproductState = $false Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
} }
# Checking services # Checking services
@ -529,124 +528,65 @@ public static string GetString(uint strId)
} }
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count $Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Specify whether Antispyware protection is enabled # Check Microsoft Defender state
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") $productState = (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName Antivirusproduct | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
{ $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled) if ($DefenderState -notmatch "00|01")
{
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
}
else
{ {
$Script:DefenderAntispywareEnabled = $false # Defender is a currently used AV. Continue...
} $Script:DefenderProductState = $true
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check if Windows is Enterprise for Chineese Goverment which doesn't have Defender
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"})
{ {
if ($Script:DefenderproductState) # Defender is a currently used AV. Continue...
$Script:DefenderProductState = $true
# Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{ {
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1) $Script:AntiSpywareEnabled = $false
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
} }
else else
{ {
$Script:DefenderProductState = $false $Script:AntiSpywareEnabled = $true
} }
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page # Check whether Microsoft Defender was turned off via GPO
Start-Process -FilePath "ms-settings:windowsupdate" # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
exit {
} $Script:RealtimeMonitoringEnabled = $false
} }
else else
{ {
$Script:DefenderProductState = $false $Script:RealtimeMonitoringEnabled = $true
} }
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check whether Microsoft Defender was turned off via GPO
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
{ if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0") {
{ $Script:BehaviorMonitoringEnabled = $false
$Script:DefenderAMEngineVersion = $false }
else
{
$Script:BehaviorMonitoringEnabled = $true
}
} }
else else
{ {
$Script:DefenderAMEngineVersion = $true # Windows is Enterprise for Chineese Goverment
$Script:DefenderProductState = $false
} }
} }
else else
{ {
$Script:DefenderAMEngineVersion = $false $Script:DefenderProductState = $false
}
# Check whether Microsoft Defender was turned off
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
$Script:DisableAntiSpyware = $true
}
else
{
$Script:DisableAntiSpyware = $false
}
# Check whether real-time protection prompts for known malware detection
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{
$Script:DisableRealtimeMonitoring = $true
}
else
{
$Script:DisableRealtimeMonitoring = $false
}
# Check whether behavior monitoring was disabled
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{
$Script:DisableBehaviorMonitoring = $true
}
else
{
$Script:DisableBehaviorMonitoring = $false
} }
if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -815,17 +755,6 @@ public static string GetString(uint strId)
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
} }
# Check if Microsoft Store as being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word # PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore
@ -1019,7 +948,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1156,7 +1085,7 @@ function script:AdditionalActions
exit exit
} }
} }
#endregion Additional functions #endregion Additional function
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -13574,10 +13503,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

160
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -103,6 +103,16 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch (((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -eq 17763) -and ((Get-WindowsEdition -Online).Edition -eq "EnterpriseS")) switch (((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -eq 17763) -and ((Get-WindowsEdition -Online).Edition -eq "EnterpriseS"))
{ {
$false
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
$true $true
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 4974) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 4974)
@ -129,16 +139,6 @@ public static string GetString(uint strId)
exit exit
} }
} }
$false
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
} }
# Check the language mode # Check the language mode
@ -218,6 +218,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -357,6 +359,17 @@ public static string GetString(uint strId)
} }
} }
# Checking whether Windows Security Settings page was hidden from UI
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Checking whether WMI is corrupted # Checking whether WMI is corrupted
try try
{ {
@ -406,107 +419,48 @@ public static string GetString(uint strId)
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01") if ($DefenderState -notmatch "00|01")
{ {
$Script:DefenderproductState = $true # Defender is a currently used AV. Continue...
} $Script:DefenderProductState = $true
else
{
$Script:DefenderproductState = $false
}
# Specify whether Antispyware protection is enabled # Check whether Microsoft Defender was turned off via GPO
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled) # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
{ if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"})
{
if ($Script:DefenderproductState)
{ {
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1) $Script:AntiSpywareEnabled = $false
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
} }
else else
{ {
$Script:DefenderProductState = $false $Script:AntiSpywareEnabled = $true
} }
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check whether Microsoft Defender was turned off via GPO
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0") # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
{ if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
$Script:DefenderAMEngineVersion = $false {
} $Script:RealtimeMonitoringEnabled = $false
else }
{ else
$Script:DefenderAMEngineVersion = $true {
} $Script:RealtimeMonitoringEnabled = $true
}
# Check whether Microsoft Defender was turned off
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
$Script:DisableAntiSpyware = $true
}
else
{
$Script:DisableAntiSpyware = $false
}
# Check whether real-time protection prompts for known malware detection
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{
$Script:DisableRealtimeMonitoring = $true
}
else
{
$Script:DisableRealtimeMonitoring = $false
}
# Check whether behavior monitoring was disabled # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{ {
$Script:DisableBehaviorMonitoring = $true $Script:BehaviorMonitoringEnabled = $false
}
else
{
$Script:BehaviorMonitoringEnabled = $true
}
} }
else else
{ {
$Script:DisableBehaviorMonitoring = $false $Script:DefenderProductState = $false
} }
if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -868,7 +822,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1005,7 +959,7 @@ function script:AdditionalActions
exit exit
} }
} }
#endregion Additional functions #endregion Additional function
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -10168,10 +10122,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

160
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -103,6 +103,16 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch (((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -eq 19044) -and ((Get-WindowsEdition -Online).Edition -match "EnterpriseS")) switch (((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber -eq 19044) -and ((Get-WindowsEdition -Online).Edition -match "EnterpriseS"))
{ {
$false
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
$true $true
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570)
@ -129,16 +139,6 @@ public static string GetString(uint strId)
exit exit
} }
} }
$false
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
} }
# Check the language mode # Check the language mode
@ -218,6 +218,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -357,6 +359,17 @@ public static string GetString(uint strId)
} }
} }
# Checking whether Windows Security Settings page was hidden from UI
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Checking whether WMI is corrupted # Checking whether WMI is corrupted
try try
{ {
@ -406,107 +419,48 @@ public static string GetString(uint strId)
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01") if ($DefenderState -notmatch "00|01")
{ {
$Script:DefenderproductState = $true # Defender is a currently used AV. Continue...
} $Script:DefenderProductState = $true
else
{
$Script:DefenderproductState = $false
}
# Specify whether Antispyware protection is enabled
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled)
{
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"}) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
if ($Script:DefenderproductState)
{ {
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1) $Script:AntiSpywareEnabled = $false
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
} }
else else
{ {
$Script:DefenderProductState = $false $Script:AntiSpywareEnabled = $true
} }
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0")
{
$Script:DefenderAMEngineVersion = $false
}
else
{
$Script:DefenderAMEngineVersion = $true
}
# Check whether Microsoft Defender was turned off # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{ {
$Script:DisableAntiSpyware = $true $Script:RealtimeMonitoringEnabled = $false
} }
else else
{ {
$Script:DisableAntiSpyware = $false $Script:RealtimeMonitoringEnabled = $true
} }
# Check whether real-time protection prompts for known malware detection
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{
$Script:DisableRealtimeMonitoring = $true
}
else
{
$Script:DisableRealtimeMonitoring = $false
}
# Check whether behavior monitoring was disabled # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{ {
$Script:DisableBehaviorMonitoring = $true $Script:BehaviorMonitoringEnabled = $false
}
else
{
$Script:BehaviorMonitoringEnabled = $true
}
} }
else else
{ {
$Script:DisableBehaviorMonitoring = $false $Script:DefenderProductState = $false
} }
if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -868,7 +822,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1005,7 +959,7 @@ function script:AdditionalActions
exit exit
} }
} }
#endregion Additional functions #endregion Additional function
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -11284,10 +11238,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

265
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -163,8 +163,8 @@ public static string GetString(uint strId)
} }
catch [System.Net.WebException] catch [System.Net.WebException]
{ {
Write-Warning -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") Write-Warning -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com") -ErrorAction SilentlyContinue
} }
} }
catch [System.ComponentModel.Win32Exception] catch [System.ComponentModel.Win32Exception]
@ -188,6 +188,16 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{ {
{($_ -lt 19045) -or ($_ -gt 19045)}
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
{$_ -eq 19045} {$_ -eq 19045}
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 3570)
@ -217,16 +227,6 @@ public static string GetString(uint strId)
exit exit
} }
} }
{($_ -lt 19045) -or ($_ -gt 19045)}
{
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
} }
# Check the language mode # Check the language mode
@ -306,6 +306,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -391,6 +393,17 @@ public static string GetString(uint strId)
exit exit
} }
# Check if Microsoft Store being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Check if the current module version is the latest one # Check if the current module version is the latest one
try try
{ {
@ -461,57 +474,43 @@ public static string GetString(uint strId)
} }
} }
# The Enterprise G edition doesn't has a built-in Defender # Checking whether Windows Security Settings page was hidden from UI
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{ {
# Checking whether WMI is corrupted Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
try
{
Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null
}
catch [Microsoft.Management.Infrastructure.CimException]
{
# Provider Load Failure exception
Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat" Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79" Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit exit
}
} }
# Check Microsoft Defender state # Checking whether WMI is corrupted
# The Enterprise G edition doesn't has a built-in Defender try
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{ {
# Check Microsoft Defender state Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender -ErrorAction Stop | Out-Null
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore)) }
{ catch [Microsoft.Management.Infrastructure.CimException]
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender") {
# Provider Load Failure exception
Start-Process -FilePath "https://t.me/sophia_chat" Write-Warning -Message $Global:Error.Exception.Message | Select-Object -First 1
Start-Process -FilePath "https://discord.gg/sSryhaEv79" Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
exit Start-Process -FilePath "https://t.me/sophia_chat"
} Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Check Microsoft Defender state exit
$productState = (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName Antivirusproduct | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01")
{
$Script:DefenderproductState = $true
}
else
{
$Script:DefenderproductState = $false
}
} }
else
# Check Microsoft Defender state
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{ {
$Script:DefenderproductState = $false Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
} }
# Checking services # Checking services
@ -530,124 +529,65 @@ public static string GetString(uint strId)
} }
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count $Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Specify whether Antispyware protection is enabled # Check Microsoft Defender state
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") $productState = (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName Antivirusproduct | Where-Object -FilterScript {$_.instanceGuid -eq "{D68DDC3A-831F-4fae-9E44-DA132C1ACF46}"}).productState
{ $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled) if ($DefenderState -notmatch "00|01")
{
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
}
else
{ {
$Script:DefenderAntispywareEnabled = $false # Defender is a currently used AV. Continue...
} $Script:DefenderProductState = $true
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check if Windows is Enterprise for Chineese Goverment which doesn't have Defender
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"})
{ {
if ($Script:DefenderproductState) # Defender is a currently used AV. Continue...
$Script:DefenderProductState = $true
# Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{ {
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1) $Script:AntiSpywareEnabled = $false
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
} }
else else
{ {
$Script:DefenderProductState = $false $Script:AntiSpywareEnabled = $true
} }
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page # Check whether Microsoft Defender was turned off via GPO
Start-Process -FilePath "ms-settings:windowsupdate" # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
exit {
} $Script:RealtimeMonitoringEnabled = $false
} }
else else
{ {
$Script:DefenderProductState = $false $Script:RealtimeMonitoringEnabled = $true
} }
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check whether Microsoft Defender was turned off via GPO
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG") # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
{ if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0") {
{ $Script:BehaviorMonitoringEnabled = $false
$Script:DefenderAMEngineVersion = $false }
else
{
$Script:BehaviorMonitoringEnabled = $true
}
} }
else else
{ {
$Script:DefenderAMEngineVersion = $true # Windows is Enterprise for Chineese Goverment
$Script:DefenderProductState = $false
} }
} }
else else
{ {
$Script:DefenderAMEngineVersion = $false $Script:DefenderProductState = $false
}
# Check whether Microsoft Defender was turned off
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
$Script:DisableAntiSpyware = $true
}
else
{
$Script:DisableAntiSpyware = $false
}
# Check whether real-time protection prompts for known malware detection
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{
$Script:DisableRealtimeMonitoring = $true
}
else
{
$Script:DisableRealtimeMonitoring = $false
}
# Check whether behavior monitoring was disabled
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{
$Script:DisableBehaviorMonitoring = $true
}
else
{
$Script:DisableBehaviorMonitoring = $false
} }
if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -816,17 +756,6 @@ public static string GetString(uint strId)
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
} }
# Check if Microsoft Store as being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word # PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore
@ -1023,7 +952,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1160,7 +1089,7 @@ function script:AdditionalActions
exit exit
} }
} }
#endregion Additional functions #endregion Additional function
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -13598,10 +13527,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Das Skript unterstützt Windows 11 22H2+. UnsupportedOSBuild = Das Skript unterstützt Windows 11 23H2+.
UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: 22621.2428+. Führen Sie Windows Update aus und versuchen Sie es erneut. UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: 22631.2715+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt. UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte. LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.
UnsupportedPowerShell = Sie versuchen ein Skript über PowerShell {0}.{1} auszuführen. Das Skript in der entsprechenden PowerShell-Version ausführen. UnsupportedPowerShell = Sie versuchen ein Skript über PowerShell {0}.{1} auszuführen. Das Skript in der entsprechenden PowerShell-Version ausführen.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = The script supports Windows 11 22H2+. UnsupportedOSBuild = The script supports Windows 11 23H2+.
UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: 22621.2428+. Run Windows Update and try again. UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: 22631.2715+. Run Windows Update and try again.
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}. 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.
@ -15,6 +15,7 @@ CustomizationWarning = Have you customized every function i
WindowsComponentBroken = {0} broken or removed from the OS. WindowsComponentBroken = {0} broken or removed from the OS.
UpdateDefender = Microsoft Defender definitions are out-of-date. Run Windows Update and try again. UpdateDefender = Microsoft Defender definitions are out-of-date. Run Windows Update and try again.
ControlledFolderAccessDisabled = Controlled folder access disabled. ControlledFolderAccessDisabled = Controlled folder access disabled.
InitialActionsCheckFailed = Please do not remove "InitialActions" function from preset file.
ScheduledTasks = Scheduled tasks ScheduledTasks = Scheduled tasks
OneDriveUninstalling = Uninstalling OneDrive... OneDriveUninstalling = Uninstalling OneDrive...
OneDriveInstalling = Installing OneDrive... OneDriveInstalling = Installing OneDrive...

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = El script es compatible con Windows 11 22H2+. UnsupportedOSBuild = El script es compatible con Windows 11 23H2+.
UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: 22621.2428+. Ejecute Windows Update y vuelva a intentarlo. UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: 22631.2715+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado. UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador. LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.
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.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Le script prend en charge Windows 11 22H2+. UnsupportedOSBuild = Le script prend en charge Windows 11 23H2+.
UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: 22621.2428+. Exécutez Windows Update et réessayez. UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: 22631.2715+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité. UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur. LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.
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.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = A szkript támogatja a Windows 11 22H2+ rendszert. UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2+ rendszert.
UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: 22621.2428+. Futtassa a Windows Update programot, és próbálja meg újra. UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: 22631.2715+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut. UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal. LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.
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.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Lo script supporta Windows 11 22H2+. UnsupportedOSBuild = Lo script supporta Windows 11 23H2+.
UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: 22621.2428+. Eseguire Windows Update e riprovare. UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: 22631.2715+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata. UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore. LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.
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.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Skrypt obsługuje system Windows 11 22H2+. UnsupportedOSBuild = Skrypt obsługuje system Windows 11 23H2+.
UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: 22621.2428+. Uruchom aktualizację systemu Windows i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: 22631.2715+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora. LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.
UnsupportedPowerShell = Próbujesz uruchomić skrypt przy użyciu PowerShell {0}.{1}. Uruchom skrypt używając odpowiedniej wersji PowerShell. UnsupportedPowerShell = Próbujesz uruchomić skrypt przy użyciu PowerShell {0}.{1}. Uruchom skrypt używając odpowiedniej wersji PowerShell.

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = O script suporta Windows 11 22H2+. UnsupportedOSBuild = O script suporta Windows 11 23H2+.
UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: 22621.2428+. Execute o Windows Update e tente novamente. UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: 22631.2715+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada. UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador. LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.
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.

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

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

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Komut dosyası Windows 11 22H2+' destekler. UnsupportedOSBuild = Komut dosyası Windows 11 23H2+' destekler.
UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: 22621.2428+. Windows Update'i çalıştırın ve tekrar deneyin. UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: 22631.2715+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu. UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok. LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.
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.

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

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

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

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = 脚本支持Windows 11 22H2+ UnsupportedOSBuild = 脚本支持Windows 11 23H2+
UpdateWarning = 您的Windows 11构建: {0}.{1}支持的构建: 22621.2428+运行Windows Update并再次尝试 UpdateWarning = 您的Windows 11构建: {0}.{1}支持的构建: 22631.2715+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行 UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利 LoggedInUserNotAdmin = 登录的用户没有管理员的权利
UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本 UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本

319
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -12,8 +12,8 @@
.NOTES .NOTES
Supported Windows 11 versions Supported Windows 11 versions
Version: 22H2/23H2+ Version: 23H2/23H2+
Builds: 22621.2428+ Builds: 22631.2715+
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
.LINK GitHub .LINK GitHub
@ -166,8 +166,8 @@ public static string GetString(uint strId)
} }
catch [System.Net.WebException] catch [System.Net.WebException]
{ {
Write-Warning -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") Write-Warning -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com") -ErrorAction SilentlyContinue
} }
} }
catch [System.ComponentModel.Win32Exception] catch [System.ComponentModel.Win32Exception]
@ -180,87 +180,8 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{ {
{$_ -lt 22000} {$_ -lt 22631}
{ {
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
{$_ -eq 22000}
{
if (Test-Path -Path "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe")
{
Start-Process -FilePath "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe"
break
}
try
{
# Check the internet connection
$Parameters = @{
Name = "dns.msftncsi.com"
Server = "1.1.1.1"
DnsOnly = $true
ErrorAction = "Stop"
}
if ((Resolve-DnsName @Parameters).IPAddress -notcontains "131.107.255.255")
{
return
}
try
{
# Download PC Health Check app to start upgrade
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/GetPCHealthCheckApp"
OutFile = "$DownloadsFolder\WindowsPCHealthCheckSetup.msi"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Extract WindowsPCHealthCheckSetup.msi without installing
$Arguments = @(
"/a `"$DownloadsFolder\WindowsPCHealthCheckSetup.msi`"",
"TARGETDIR=`"$DownloadsFolder\WindowsPCHealthCheckSetup`"",
"/qb"
)
Start-Process -FilePath "msiexec" -ArgumentList $Arguments -Wait
Remove-Item -Path "$DownloadsFolder\WindowsPCHealthCheckSetup.msi" -Force
Start-Process -FilePath "$DownloadsFolder\WindowsPCHealthCheckSetup\PCHealthCheck\PCHealthCheck.exe"
# Download Windows 11 Installation Assistant
# https://www.microsoft.com/software-download/windows11
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://go.microsoft.com/fwlink/?linkid=2171764"
OutFile = "$DownloadsFolder\Windows11InstallationAssistant.exe"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\Windows11InstallationAssistant.exe" -ArgumentList "/SkipEULA"
exit
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "microsoft.com") -ErrorAction SilentlyContinue
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
}
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild $CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR $UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR) Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR)
@ -283,11 +204,11 @@ public static string GetString(uint strId)
exit exit
} }
{$_ -eq 22621} {$_ -eq 22631}
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 2428) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 2715)
{ {
# Check whether the OS minor build version is 2428 minimum # Check whether the OS minor build version is 2715 minimum
# https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information#windows-11-current-versions # https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information#windows-11-current-versions
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild $CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR $UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
@ -391,6 +312,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -471,6 +394,17 @@ public static string GetString(uint strId)
exit exit
} }
# Check if Microsoft Store being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Check if the current module version is the latest one # Check if the current module version is the latest one
try try
{ {
@ -541,6 +475,17 @@ public static string GetString(uint strId)
} }
} }
# Checking whether Windows Security Settings page was hidden from UI
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Checking whether WMI is corrupted # Checking whether WMI is corrupted
try try
{ {
@ -590,110 +535,48 @@ public static string GetString(uint strId)
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2) $DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01") if ($DefenderState -notmatch "00|01")
{ {
$Script:DefenderproductState = $true # Defender is a currently used AV. Continue...
} $Script:DefenderProductState = $true
else
{
$Script:DefenderproductState = $false
}
# Specify whether Antispyware protection is enabled
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled)
{
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"}) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
if ($Script:DefenderproductState)
{ {
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1) $Script:AntiSpywareEnabled = $false
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
} }
else else
{ {
$Script:DefenderProductState = $false $Script:AntiSpywareEnabled = $true
} }
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0")
{
$Script:DefenderAMEngineVersion = $false
}
else
{
$Script:DefenderAMEngineVersion = $true
}
# Check whether Microsoft Defender was turned off
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{
$Script:DisableAntiSpyware = $true
}
else
{
$Script:DisableAntiSpyware = $false
}
# Check whether real-time protection prompts for known malware detection # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{ {
$Script:DisableRealtimeMonitoring = $true $Script:RealtimeMonitoringEnabled = $false
} }
else else
{ {
$Script:DisableRealtimeMonitoring = $false $Script:RealtimeMonitoringEnabled = $true
} }
# Check whether behavior monitoring was disabled # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{ {
$Script:DisableBehaviorMonitoring = $true $Script:BehaviorMonitoringEnabled = $false
}
else
{
$Script:BehaviorMonitoringEnabled = $true
}
} }
else else
{ {
$Script:DisableBehaviorMonitoring = $false $Script:DefenderProductState = $false
} }
if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -862,17 +745,6 @@ public static string GetString(uint strId)
Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue Write-Error -Message ($Localization.RestartFunction -f $MyInvocation.Line.Trim()) -ErrorAction SilentlyContinue
} }
# Check if Microsoft Store as being an important system component was removed
if (-not (Get-AppxPackage -Name Microsoft.WindowsStore))
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Store")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word # PowerShell 5.1 (7.3 too) interprets 8.3 file name literally, if an environment variable contains a non-latin word
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore
@ -1066,7 +938,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1160,50 +1032,7 @@ $($Type):$($Value)`n
Add-Content -Path $Path -Value $Policy -Encoding Default -Force Add-Content -Path $Path -Value $Policy -Encoding Default -Force
} }
#endregion Additional function
# Revert back removed or commented out "InitialActions" functions
function script:AdditionalActions
{
# Get the name of a preset (e.g Sophia.ps1) regardless it was named
# $_.File has no EndsWith() method
$PresetName = ((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}
if (Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch)
{
# The string exists and is commented
if ((Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch).Line.StartsWith("#") -eq $true)
{
$Host.UI.RawUI.WindowTitle = "InitialActions | $($PresetName)"
# Calculate the string number to uncomment "InitialActions -Warning"
$LineNumber = (Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch).LineNumber
# Get data from the required line to replace it with "InitialActions -Warning"
$RequiredLine = (Get-Content -Path $PresetName -Encoding UTF8) | Where-Object -FilterScript {$_.ReadCount -eq $LineNumber}
(Get-Content -Path $PresetName -Encoding UTF8).Replace($RequiredLine, "InitialActions -Warning") | Set-Content -Path $PresetName -Encoding UTF8 -Force
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
}
else
{
$Host.UI.RawUI.WindowTitle = "InitialActions | $($PresetName)"
$ReadFile = Get-Content -Path $PresetName -Encoding UTF8
# Calculate the string number to add after "InitialActions -Warning"
$LineNumber = (Select-String -Path $PresetName -Pattern Import-LocalizedData).LineNumber
# Array of a new file: content before $LineNumber (including $LineNumber), new added string, the rest data of file
$UpdatedFile = @($ReadFile[0..($LineNumber - 1)], "`nInitialActions -Warning", $ReadFile[$LineNumber..($ReadFile.Length + 1)])
Set-Content -Path $PresetName -Value $UpdatedFile -Encoding UTF8 -Force
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
}
#endregion Additional functions
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -1247,8 +1076,16 @@ function DiagTrackService
$Enable $Enable
) )
# Revert back removed or commented out "InitialActions" functions # Check whether "InitialActions" function was removed in preset file
AdditionalActions if (-not ("WinAPI.GetStr" -as [type])) ###
{
Write-Warning -Message $Localization.InitialActionsCheckFailed
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
switch ($PSCmdlet.ParameterSetName) switch ($PSCmdlet.ParameterSetName)
{ {
@ -10612,7 +10449,7 @@ FEA494190BF3446DCC8C8AAF62BA01F0BFB18E15503C27558DB70C48EFB0AEA0B600F985C904E9F2
2EEEF7B09850D29B2F412DEF3D0BD9194CAE8113B3B38085C77C238CB8D15BF6D6AB42C193F4E2F27F8BEDABB2D6ADE9E486B6AFAFD8D5DBE3B7D7305790F96ECDCC2DD016C5B9B200CB72E6CF54D71 2EEEF7B09850D29B2F412DEF3D0BD9194CAE8113B3B38085C77C238CB8D15BF6D6AB42C193F4E2F27F8BEDABB2D6ADE9E486B6AFAFD8D5DBE3B7D7305790F96ECDCC2DD016C5B9B200CB72E6CF54D71
F69A01CDE4E3A0A4C5A03627DECD491F215C1420EB07AB8FD2763FCFF5211EB964C82E69DA208BDFA76306D54642B117DCB9A92927CE2E633338D4EEA63B571349B8DA1D4B5523C4CA10308769E4F46 F69A01CDE4E3A0A4C5A03627DECD491F215C1420EB07AB8FD2763FCFF5211EB964C82E69DA208BDFA76306D54642B117DCB9A92927CE2E633338D4EEA63B571349B8DA1D4B5523C4CA10308769E4F46
1ADD16DD5DFDB0E705187593DEF5CCCF659E48366462CC21D7930E1064234157A7A08E9C90927A37C5CF23D54C755002E4E657BB6E70D9B4BE7C468C19D6969FAE138EBF2C20DD3F5A0BC4C0E97D5BF 1ADD16DD5DFDB0E705187593DEF5CCCF659E48366462CC21D7930E1064234157A7A08E9C90927A37C5CF23D54C755002E4E657BB6E70D9B4BE7C468C19D6969FAE138EBF2C20DD3F5A0BC4C0E97D5BF
DB8744A21396C44549242817BEAD5AE14FF602E69E75B87784DE5F30BE14106E8D8A081DC8CCCFBF93896E622F755F27E82A596DDCA3469A93ECB9E2E897BF0FCC063426DACDC3B1D81E1EFE6B63932 DB8744A21396C44549271517BEAD5AE14FF602E69E75B87784DE5F30BE14106E8D8A081DC8CCCFBF93896E622F755F27E82A596DDCA3469A93ECB9E2E897BF0FCC063426DACDC3B1D81E1EFE6B63932
6CA43526CFAEDF9922EAC3204FEB84AAED781EE5516FA5B4DCAB85DB5FF33CEC454DAA375BDA5EEA7C871C310AEDC5BD6B220B59B901D377E22FFFE95FEDA28CE2CE33CAEB8541EE05E1B5650D776C4 6CA43526CFAEDF9922EAC3204FEB84AAED781EE5516FA5B4DCAB85DB5FF33CEC454DAA375BDA5EEA7C871C310AEDC5BD6B220B59B901D377E22FFFE95FEDA28CE2CE33CAEB8541EE05E1B5650D776C4
B2A246DB4613E2CC5D96A44D24AE662D848A7C9E3E922AFF0632B7B40505402956FABC5C3AAB55EEE29085046C127E8776CEFC1690B76EE99371AF9B1D7EF6F79E78325DD3BD8377E9B73B936C6F261 B2A246DB4613E2CC5D96A44D24AE662D848A7C9E3E922AFF0632B7B40505402956FABC5C3AAB55EEE29085046C127E8776CEFC1690B76EE99371AF9B1D7EF6F79E78325DD3BD8377E9B73B936C6F261
1D0A1223A4D7C6CF3037922DD0686A701FF86761993F294D26E13A7BB8B1C61ACAF38D50334A88DABB3FA412B4FC79F6FBFD0D0A92301484FF1BD1CF3DC67780E4562E05CCA329CABA7CB2B77D9A707 1D0A1223A4D7C6CF3037922DD0686A701FF86761993F294D26E13A7BB8B1C61ACAF38D50334A88DABB3FA412B4FC79F6FBFD0D0A92301484FF1BD1CF3DC67780E4562E05CCA329CABA7CB2B77D9A707
@ -11562,7 +11399,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
The extension can be installed without Microsoft account The extension can be installed without Microsoft account
.NOTES .NOTES
HEVC Video Extension is already installed in Windows 11 22H2 by default HEVC Video Extension is already installed in Windows 11 23H2 by default
.NOTES .NOTES
Current user Current user
@ -13016,10 +12853,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

4
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -26,8 +26,8 @@
.NOTES .NOTES
Supported Windows 11 versions Supported Windows 11 versions
Version: 22H2 Version: 23H2
Builds: 22621.2428+ Builds: 22631.2715+
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
.NOTES .NOTES

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/de-DE/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Das Skript unterstützt Windows 11 22H2+. UnsupportedOSBuild = Das Skript unterstützt Windows 11 23H2+.
UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: 22621.2428+. Führen Sie Windows Update aus und versuchen Sie es erneut. UpdateWarning = Ihr Windows 11-Build: {0}.{1}. Unterstützter Builds: 22631.2715+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt. UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte. LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.
UnsupportedPowerShell = Sie versuchen ein Skript über PowerShell {0}.{1} auszuführen. Das Skript in der entsprechenden PowerShell-Version ausführen. UnsupportedPowerShell = Sie versuchen ein Skript über PowerShell {0}.{1} auszuführen. Das Skript in der entsprechenden PowerShell-Version ausführen.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/en-US/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = The script supports Windows 11 22H2+. UnsupportedOSBuild = The script supports Windows 11 23H2+.
UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: 22621.2428+. Run Windows Update and try again. UpdateWarning = Your Windows 11 build: {0}.{1}. Supported builds: 22631.2715+. Run Windows Update and try again.
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}. 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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/es-ES/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = El script es compatible con Windows 11 22H2+. UnsupportedOSBuild = El script es compatible con Windows 11 23H2+.
UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: 22621.2428+. Ejecute Windows Update y vuelva a intentarlo. UpdateWarning = Su build de Windows 11: {0}.{1}. Compilaciones compatibles: 22631.2715+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado. UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador. LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/fr-FR/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Le script prend en charge Windows 11 22H2+. UnsupportedOSBuild = Le script prend en charge Windows 11 23H2+.
UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: 22621.2428+. Exécutez Windows Update et réessayez. UpdateWarning = Votre version de Windows 11 : {0}.{1}. Versions prises en charge: 22631.2715+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité. UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur. LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/hu-HU/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = A szkript támogatja a Windows 11 22H2+ rendszert. UnsupportedOSBuild = A szkript támogatja a Windows 11 23H2+ rendszert.
UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: 22621.2428+. Futtassa a Windows Update programot, és próbálja meg újra. UpdateWarning = Az Ön Windows 11 építése: {0}.{1}. Támogatott buildek: 22631.2715+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut. UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal. LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/it-IT/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Lo script supporta Windows 11 22H2+. UnsupportedOSBuild = Lo script supporta Windows 11 23H2+.
UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: 22621.2428+. Eseguire Windows Update e riprovare. UpdateWarning = La tua build di Windows 11 {0}.{1} non è supportata. Build supportate: 22631.2715+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata. UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore. LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pl-PL/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Skrypt obsługuje system Windows 11 22H2+. UnsupportedOSBuild = Skrypt obsługuje system Windows 11 23H2+.
UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: 22621.2428+. Uruchom aktualizację systemu Windows i spróbuj ponownie. UpdateWarning = Twoja wersja systemu Windows 11: {0}.{1}. Obsługiwane kompilacje: 22631.2715+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka. UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora. LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.
UnsupportedPowerShell = Próbujesz uruchomić skrypt przy użyciu PowerShell {0}.{1}. Uruchom skrypt używając odpowiedniej wersji PowerShell. UnsupportedPowerShell = Próbujesz uruchomić skrypt przy użyciu PowerShell {0}.{1}. Uruchom skrypt używając odpowiedniej wersji PowerShell.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/pt-BR/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = O script suporta Windows 11 22H2+. UnsupportedOSBuild = O script suporta Windows 11 23H2+.
UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: 22621.2428+. Execute o Windows Update e tente novamente. UpdateWarning = La tua build di Windows 11: {0}.{1}. Build suportadas: 22631.2715+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada. UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador. LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/ru-RU/Sophia.psd1

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

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/tr-TR/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = Komut dosyası Windows 11 22H2+' destekler. UnsupportedOSBuild = Komut dosyası Windows 11 23H2+' destekler.
UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: 22621.2428+. Windows Update'i çalıştırın ve tekrar deneyin. UpdateWarning = Windows 11 yapınız: {0}.{1}. Desteklenen yapılar: 22631.2715+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu. UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok. LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.
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.

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/uk-UA/Sophia.psd1

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

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Localizations/zh-CN/Sophia.psd1

@ -1,6 +1,6 @@
ConvertFrom-StringData -StringData @' ConvertFrom-StringData -StringData @'
UnsupportedOSBuild = 脚本支持Windows 11 22H2+ UnsupportedOSBuild = 脚本支持Windows 11 23H2+
UpdateWarning = 您的Windows 11构建: {0}.{1}支持的构建: 22621.2428+运行Windows Update并再次尝试 UpdateWarning = 您的Windows 11构建: {0}.{1}支持的构建: 22631.2715+运行Windows Update并再次尝试
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行 UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行
LoggedInUserNotAdmin = 登录的用户没有管理员的权利 LoggedInUserNotAdmin = 登录的用户没有管理员的权利
UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本 UnsupportedPowerShell = 你想通过PowerShell {0}.{1}运行脚本在适当的PowerShell版本中运行该脚本

247
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -12,8 +12,8 @@
.NOTES .NOTES
Supported Windows 11 versions Supported Windows 11 versions
Version: 22H2/23H2+ Version: 23H2/23H2+
Builds: 22621.2428+ Builds: 22631.2715+
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
.LINK GitHub .LINK GitHub
@ -162,8 +162,8 @@ public static string GetString(uint strId)
} }
catch [System.Net.WebException] catch [System.Net.WebException]
{ {
Write-Warning -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") Write-Warning -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "https://c2rsetup.officeapps.live.com") -ErrorAction SilentlyContinue Write-Error -Message ($Localization.NoResponse -f "https://edgeupdates.microsoft.com") -ErrorAction SilentlyContinue
} }
} }
catch [System.ComponentModel.Win32Exception] catch [System.ComponentModel.Win32Exception]
@ -176,87 +176,8 @@ public static string GetString(uint strId)
# Detect the OS build version # Detect the OS build version
switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber) switch ((Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber)
{ {
{$_ -lt 22000} {$_ -lt 22631}
{ {
Write-Warning -Message $Localization.UnsupportedOSBuild
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#system-requirements"
exit
}
{$_ -eq 22000}
{
if (Test-Path -Path "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe")
{
Start-Process -FilePath "$env:LOCALAPPDATA\PCHealthCheck\PCHealthCheck.exe"
break
}
try
{
# Check the internet connection
$Parameters = @{
Name = "dns.msftncsi.com"
Server = "1.1.1.1"
DnsOnly = $true
ErrorAction = "Stop"
}
if ((Resolve-DnsName @Parameters).IPAddress -notcontains "131.107.255.255")
{
return
}
try
{
# Download PC Health Check app to start upgrade
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://aka.ms/GetPCHealthCheckApp"
OutFile = "$DownloadsFolder\WindowsPCHealthCheckSetup.msi"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
# Extract WindowsPCHealthCheckSetup.msi without installing
$Arguments = @(
"/a `"$DownloadsFolder\WindowsPCHealthCheckSetup.msi`"",
"TARGETDIR=`"$DownloadsFolder\WindowsPCHealthCheckSetup`"",
"/qb"
)
Start-Process -FilePath "msiexec" -ArgumentList $Arguments -Wait
Remove-Item -Path "$DownloadsFolder\WindowsPCHealthCheckSetup.msi" -Force
Start-Process -FilePath "$DownloadsFolder\WindowsPCHealthCheckSetup\PCHealthCheck\PCHealthCheck.exe"
# Download Windows 11 Installation Assistant
# https://www.microsoft.com/software-download/windows11
$DownloadsFolder = Get-ItemPropertyValue -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$Parameters = @{
Uri = "https://go.microsoft.com/fwlink/?linkid=2171764"
OutFile = "$DownloadsFolder\Windows11InstallationAssistant.exe"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
Start-Process -FilePath "$DownloadsFolder\Windows11InstallationAssistant.exe" -ArgumentList "/SkipEULA"
exit
}
catch [System.Net.WebException]
{
Write-Warning -Message ($Localization.NoResponse -f "microsoft.com")
Write-Error -Message ($Localization.NoResponse -f "microsoft.com") -ErrorAction SilentlyContinue
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Warning -Message $Localization.NoInternetConnection
Write-Error -Message $Localization.NoInternetConnection -ErrorAction SilentlyContinue
}
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild $CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR $UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR) Write-Warning -Message ($Localization.UpdateWarning -f $CurrentBuild.CurrentBuild, $UBR.UBR)
@ -279,11 +200,11 @@ public static string GetString(uint strId)
exit exit
} }
{$_ -eq 22621} {$_ -eq 22631}
{ {
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 2428) if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 2715)
{ {
# Check whether the OS minor build version is 2428 minimum # Check whether the OS minor build version is 2715 minimum
# https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information#windows-11-current-versions # https://learn.microsoft.com/en-us/windows/release-health/windows11-release-information#windows-11-current-versions
$CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild $CurrentBuild = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name CurrentBuild
$UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR $UBR = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR
@ -387,6 +308,8 @@ public static string GetString(uint strId)
"WinterOS Tweaker" = "$env:SystemRoot\WinterOS*" "WinterOS Tweaker" = "$env:SystemRoot\WinterOS*"
# https://github.com/ThePCDuke/WinCry # https://github.com/ThePCDuke/WinCry
WinCry = "$env:SystemRoot\TempCleaner.exe" WinCry = "$env:SystemRoot\TempCleaner.exe"
# https://hone.gg
Hone = "$env:LOCALAPPDATA\Programs\Hone\Hone.exe"
} }
foreach ($Tweaker in $Tweakers.Keys) foreach ($Tweaker in $Tweakers.Keys)
{ {
@ -554,14 +477,14 @@ public static string GetString(uint strId)
} }
# Checking whether Windows Security Settings page was hidden from UI # Checking whether Windows Security Settings page was hidden from UI
# Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender") if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{ {
$Script:DefenderSettingsPageDisplayed = $false Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
}
else Start-Process -FilePath "https://t.me/sophia_chat"
{ Start-Process -FilePath "https://discord.gg/sSryhaEv79"
$Script:DefenderSettingsPageDisplayed = $true
exit
} }
# Checking whether WMI is corrupted # Checking whether WMI is corrupted
@ -592,17 +515,6 @@ public static string GetString(uint strId)
exit exit
} }
# Checking whether Windows Security Settings page was hidden from UI
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer", "SettingsPageVisibility", $null) -match "hide:windowsdefender")
{
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
# Checking services # Checking services
try try
{ {
@ -627,62 +539,7 @@ public static string GetString(uint strId)
# Defender is a currently used AV. Continue... # Defender is a currently used AV. Continue...
$Script:DefenderProductState = $true $Script:DefenderProductState = $true
# Specify whether Antispyware protection is enabled # Check whether Microsoft Defender was turned off via GPO
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AntispywareEnabled)
{
$Script:DefenderAntispywareEnabled = $true
}
else
{
$Script:DefenderAntispywareEnabled = $false
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
# Due to "Set-StrictMode -Version Latest" we have to call Get-Member first to check whether ProductStatus property exists
if (Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender | Get-Member | Where-Object -FilterScript {$_.Name -eq "ProductStatus"})
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).ProductStatus -eq 1)
{
$Script:DefenderProductState = $false
}
else
{
$Script:DefenderProductState = $true
}
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
# Receive updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
# Check for UWP apps updates
Get-CimInstance -Namespace root/CIMV2/mdm/dmmap -ClassName MDM_EnterpriseModernAppManagement_AppManagement01 | Invoke-CimMethod -MethodName UpdateScanMethod
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/Microsoft/Windows/Defender).AMEngineVersion -eq "0.0.0.0")
{
$Script:DefenderAMEngineVersion = $false
}
else
{
$Script:DefenderAMEngineVersion = $true
}
# Check whether Microsoft Defender was turned off
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender", "DisableAntiSpyware", $null) -eq 1)
{ {
@ -693,7 +550,7 @@ public static string GetString(uint strId)
$Script:AntiSpywareEnabled = $true $Script:AntiSpywareEnabled = $true
} }
# Check whether real-time protection prompts for known malware detection # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableRealtimeMonitoring", $null) -eq 1)
{ {
@ -704,7 +561,7 @@ public static string GetString(uint strId)
$Script:RealtimeMonitoringEnabled = $true $Script:RealtimeMonitoringEnabled = $true
} }
# Check whether behavior monitoring was disabled # Check whether Microsoft Defender was turned off via GPO
# Due to "Set-StrictMode -Version Latest" we have to use GetValue() # Due to "Set-StrictMode -Version Latest" we have to use GetValue()
if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1) if ([Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection", "DisableBehaviorMonitoring", $null) -eq 1)
{ {
@ -720,7 +577,7 @@ public static string GetString(uint strId)
$Script:DefenderProductState = $false $Script:DefenderProductState = $false
} }
if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled) if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
{ {
# Defender is enabled # Defender is enabled
$Script:DefenderEnabled = $true $Script:DefenderEnabled = $true
@ -1082,7 +939,7 @@ function CreateRestorePoint
} }
#endregion Protection #endregion Protection
#region Additional functions #region Additional function
<# <#
.SYNOPSIS .SYNOPSIS
Create pre-configured text files for LGPO.exe tool Create pre-configured text files for LGPO.exe tool
@ -1176,50 +1033,7 @@ $($Type):$($Value)`n
Add-Content -Path $Path -Value $Policy -Encoding Default -Force Add-Content -Path $Path -Value $Policy -Encoding Default -Force
} }
#endregion Additional function
# Revert back removed or commented out "InitialActions" functions
function script:AdditionalActions
{
# Get the name of a preset (e.g Sophia.ps1) regardless it was named
# $_.File has no EndsWith() method
$PresetName = ((Get-PSCallStack).Position | Where-Object -FilterScript {$_.File}).File | Where-Object -FilterScript {$_.EndsWith(".ps1")}
if (Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch)
{
# The string exists and is commented
if ((Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch).Line.StartsWith("#") -eq $true)
{
$Host.UI.RawUI.WindowTitle = "InitialActions | $($PresetName)"
# Calculate the string number to uncomment "InitialActions -Warning"
$LineNumber = (Select-String -Path $PresetName -Pattern InitialActions | Select-String -Pattern "{InitialActions}", "The mandatory checks" -NotMatch).LineNumber
# Get data from the required line to replace it with "InitialActions -Warning"
$RequiredLine = (Get-Content -Path $PresetName -Encoding UTF8) | Where-Object -FilterScript {$_.ReadCount -eq $LineNumber}
(Get-Content -Path $PresetName -Encoding UTF8).Replace($RequiredLine, "InitialActions -Warning") | Set-Content -Path $PresetName -Encoding UTF8 -Force
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
}
else
{
$Host.UI.RawUI.WindowTitle = "InitialActions | $($PresetName)"
$ReadFile = Get-Content -Path $PresetName -Encoding UTF8
# Calculate the string number to add after "InitialActions -Warning"
$LineNumber = (Select-String -Path $PresetName -Pattern Import-LocalizedData).LineNumber
# Array of a new file: content before $LineNumber (including $LineNumber), new added string, the rest data of file
$UpdatedFile = @($ReadFile[0..($LineNumber - 1)], "`nInitialActions -Warning", $ReadFile[$LineNumber..($ReadFile.Length + 1)])
Set-Content -Path $PresetName -Value $UpdatedFile -Encoding UTF8 -Force
Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
exit
}
}
#endregion Additional functions
#region Privacy & Telemetry #region Privacy & Telemetry
<# <#
@ -1263,8 +1077,11 @@ function DiagTrackService
$Enable $Enable
) )
# Revert back removed or commented out "InitialActions" functions # Check whether "InitialActions" function was removed in preset file
AdditionalActions if (-not ("WinAPI.GetStr" -as [type]))
{
###
}
switch ($PSCmdlet.ParameterSetName) switch ($PSCmdlet.ParameterSetName)
{ {
@ -10628,7 +10445,7 @@ FEA494190BF3446DCC8C8AAF62BA01F0BFB18E15503C27558DB70C48EFB0AEA0B600F985C904E9F2
2EEEF7B09850D29B2F412DEF3D0BD9194CAE8113B3B38085C77C238CB8D15BF6D6AB42C193F4E2F27F8BEDABB2D6ADE9E486B6AFAFD8D5DBE3B7D7305790F96ECDCC2DD016C5B9B200CB72E6CF54D71 2EEEF7B09850D29B2F412DEF3D0BD9194CAE8113B3B38085C77C238CB8D15BF6D6AB42C193F4E2F27F8BEDABB2D6ADE9E486B6AFAFD8D5DBE3B7D7305790F96ECDCC2DD016C5B9B200CB72E6CF54D71
F69A01CDE4E3A0A4C5A03627DECD491F215C1420EB07AB8FD2763FCFF5211EB964C82E69DA208BDFA76306D54642B117DCB9A92927CE2E633338D4EEA63B571349B8DA1D4B5523C4CA10308769E4F46 F69A01CDE4E3A0A4C5A03627DECD491F215C1420EB07AB8FD2763FCFF5211EB964C82E69DA208BDFA76306D54642B117DCB9A92927CE2E633338D4EEA63B571349B8DA1D4B5523C4CA10308769E4F46
1ADD16DD5DFDB0E705187593DEF5CCCF659E48366462CC21D7930E1064234157A7A08E9C90927A37C5CF23D54C755002E4E657BB6E70D9B4BE7C468C19D6969FAE138EBF2C20DD3F5A0BC4C0E97D5BF 1ADD16DD5DFDB0E705187593DEF5CCCF659E48366462CC21D7930E1064234157A7A08E9C90927A37C5CF23D54C755002E4E657BB6E70D9B4BE7C468C19D6969FAE138EBF2C20DD3F5A0BC4C0E97D5BF
DB8744A21396C44549242817BEAD5AE14FF602E69E75B87784DE5F30BE14106E8D8A081DC8CCCFBF93896E622F755F27E82A596DDCA3469A93ECB9E2E897BF0FCC063426DACDC3B1D81E1EFE6B63932 DB8744A21396C44549271517BEAD5AE14FF602E69E75B87784DE5F30BE14106E8D8A081DC8CCCFBF93896E622F755F27E82A596DDCA3469A93ECB9E2E897BF0FCC063426DACDC3B1D81E1EFE6B63932
6CA43526CFAEDF9922EAC3204FEB84AAED781EE5516FA5B4DCAB85DB5FF33CEC454DAA375BDA5EEA7C871C310AEDC5BD6B220B59B901D377E22FFFE95FEDA28CE2CE33CAEB8541EE05E1B5650D776C4 6CA43526CFAEDF9922EAC3204FEB84AAED781EE5516FA5B4DCAB85DB5FF33CEC454DAA375BDA5EEA7C871C310AEDC5BD6B220B59B901D377E22FFFE95FEDA28CE2CE33CAEB8541EE05E1B5650D776C4
B2A246DB4613E2CC5D96A44D24AE662D848A7C9E3E922AFF0632B7B40505402956FABC5C3AAB55EEE29085046C127E8776CEFC1690B76EE99371AF9B1D7EF6F79E78325DD3BD8377E9B73B936C6F261 B2A246DB4613E2CC5D96A44D24AE662D848A7C9E3E922AFF0632B7B40505402956FABC5C3AAB55EEE29085046C127E8776CEFC1690B76EE99371AF9B1D7EF6F79E78325DD3BD8377E9B73B936C6F261
1D0A1223A4D7C6CF3037922DD0686A701FF86761993F294D26E13A7BB8B1C61ACAF38D50334A88DABB3FA412B4FC79F6FBFD0D0A92301484FF1BD1CF3DC67780E4562E05CCA329CABA7CB2B77D9A707 1D0A1223A4D7C6CF3037922DD0686A701FF86761993F294D26E13A7BB8B1C61ACAF38D50334A88DABB3FA412B4FC79F6FBFD0D0A92301484FF1BD1CF3DC67780E4562E05CCA329CABA7CB2B77D9A707
@ -11598,7 +11415,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
The extension can be installed without Microsoft account The extension can be installed without Microsoft account
.NOTES .NOTES
HEVC Video Extension is already installed in Windows 11 22H2 by default HEVC Video Extension is already installed in Windows 11 23H2 by default
.NOTES .NOTES
Current user Current user
@ -13052,10 +12869,14 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
`$Paths = @( `$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent # Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')), (-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel", "`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs" "`$env:SystemDrive\PerfLogs"
) )
if ((Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName)
{
`$Paths += (Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName
}
Remove-Item -Path `$Paths -Recurse -Force Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null

4
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -26,8 +26,8 @@
.NOTES .NOTES
Supported Windows 11 versions Supported Windows 11 versions
Version: 22H2 Version: 23H2
Builds: 22621.2428+ Builds: 22631.2715+
Editions: Home/Pro/Enterprise Editions: Home/Pro/Enterprise
.NOTES .NOTES

Loading…
Cancel
Save