Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Nov 16, 2023
1 parent 048c472 commit dac692a
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 89 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@

| Version | Marketing name | Build | Arch | Editions |
|:-------------------------------------|--------------------:|:-----------:|:----:|:-------------------:|
| Windows 11 Insider Preview 23H2 | 2023 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 11 22H2 | 2022 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 10 22H2 | 2022 Update | 19045.3570+ | x64 | Home/Pro/Enterprise |
| Windows 10 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.3570+ | x64 | Enterprise |
Expand Down
3 changes: 2 additions & 1 deletion README_de-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@

| Version | Marketing name | Build | Arch | Editions |
|:-------------------------------------|--------------------:|:-----------:|:----:|:-------------------:|
| Windows 11 Insider Preview 23H2 | 2023 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 11 22H2 | 2022 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 10 22H2 | 2022 Update | 19045.3570+ | x64 | Home/Pro/Enterprise |
| Windows 10 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.3570+ | x64 | Enterprise |
Expand Down
3 changes: 2 additions & 1 deletion README_uk-ua.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@

| Версія | Маркетингова назва | Збіркa | Архітектура | Видання |
|:-------------------------------------|--------------------:|:-----------:|:-----------:|:-------------------:|
| Windows 11 Insider Preview 23H2 | 2023 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | | Home/Pro/Enterprise |
| Windows 11 23H2 | 2023 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 11 22H2 | 2022 Update | 22621.2428+ | | Home/Pro/Enterprise |
| Windows 10 22H2 | 2022 Update | 19045.3570+ | x64 | Home/Pro/Enterprise |
| Windows 10 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.3570+ | x64 | Enterprise |
Expand Down
187 changes: 101 additions & 86 deletions src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,17 @@ public static string GetString(uint strId)
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
try
{
Expand Down Expand Up @@ -542,6 +553,17 @@ public static string GetString(uint strId)
}
}

# 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")
{
$Script:DefenderSettingsPageDisplayed = $false
}
else
{
$Script:DefenderSettingsPageDisplayed = $true
}

# Checking whether WMI is corrupted
try
{
Expand Down Expand Up @@ -570,6 +592,17 @@ public static string GetString(uint strId)
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
try
{
Expand All @@ -591,28 +624,22 @@ public static string GetString(uint strId)
$DefenderState = ('0x{0:x}' -f $productState).Substring(3, 2)
if ($DefenderState -notmatch "00|01")
{
$Script:DefenderproductState = $true
}
else
{
$Script:DefenderproductState = $false
}
# Defender is a currently used AV. Continue...
$Script:DefenderProductState = $true

# 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
}
# 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
# 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)
# 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)
{
Expand All @@ -625,76 +652,75 @@ public static string GetString(uint strId)
}
else
{
$Script:DefenderProductState = $false
}
}
else
{
Write-Warning -Message $Localization.UpdateDefender
Write-Warning -Message $Localization.UpdateDefender

Start-Process -FilePath "https://t.me/sophia_chat"
Start-Process -FilePath "https://discord.gg/sSryhaEv79"
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, "")
# 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 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
# Check for updates
Start-Process -FilePath "$env:SystemRoot\System32\UsoClient.exe" -ArgumentList StartInteractiveScan

# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"

exit
}
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
}
# 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 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:AntiSpywareEnabled = $false
}
else
{
$Script:AntiSpywareEnabled = $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 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:RealtimeMonitoringEnabled = $false
}
else
{
$Script:RealtimeMonitoringEnabled = $true
}

# 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
# 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:BehaviorMonitoringEnabled = $false
}
else
{
$Script:BehaviorMonitoringEnabled = $true
}
}
else
{
$Script:DisableBehaviorMonitoring = $false
$Script:DefenderProductState = $false
}

if ($Script:DefenderproductState -and $Script:DefenderServices -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and
(-not $Script:DisableAntiSpyware) -and (-not $Script:DisableRealtimeMonitoring) -and (-not $Script:DisableBehaviorMonitoring))
if ($Script:DefenderServices -and $Script:DefenderproductState -and $Script:DefenderAntispywareEnabled -and $Script:DefenderAMEngineVersion -and $Script:AntiSpywareEnabled -and $Script:RealtimeMonitoringEnabled -and $Script:BehaviorMonitoringEnabled)
{
# Defender is enabled
$Script:DefenderEnabled = $true
Expand Down Expand Up @@ -863,17 +889,6 @@ public static string GetString(uint strId)
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
Get-ChildItem -Path "$env:TEMP\Computer.txt", "$env:TEMP\User.txt" -Force -ErrorAction Ignore | Remove-Item -Recurse -Force -ErrorAction Ignore

Expand Down

0 comments on commit dac692a

Please sign in to comment.