Browse Source

6.2.7 — 07.01.2023

pull/437/head
Dmitry Nefedov 1 year ago
parent
commit
3093577b74
  1. 6
      src/Sophia_Script_for_Windows_10/Functions.ps1
  2. 2
      src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
  3. 145
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  4. 16
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  5. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
  6. 2
      src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
  7. 135
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  8. 16
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  9. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
  10. 2
      src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
  11. 111
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  12. 16
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  13. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
  14. 2
      src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
  15. 55
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  16. 16
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  17. 6
      src/Sophia_Script_for_Windows_11/Functions.ps1
  18. 1
      src/Sophia_Script_for_Windows_11/Localizations/en-US/Sophia.psd1
  19. 2
      src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
  20. 88
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  21. 12
      src/Sophia_Script_for_Windows_11/Sophia.ps1
  22. 6
      src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1
  23. 2
      src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1
  24. 89
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  25. 8
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

6
src/Sophia_Script_for_Windows_10/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.6'
ModuleVersion = '5.14.7'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2023 farag & Inestic. All rights reserved'

145
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -60,6 +60,7 @@ function Checks
if (-not [System.Environment]::Is64BitOperatingSystem)
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -86,6 +87,9 @@ function Checks
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
@ -193,6 +197,7 @@ function Checks
if (($PendingActions | Test-Path) -contains $true)
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -270,6 +275,20 @@ function Checks
}
}
# Checking services
try
{
$Services = Get-Service -Name Windefend, SecurityHealthService, wscsvc -ErrorAction Stop
}
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Check Microsoft Defender state
# The Enterprise G edition doesn't has a built-in Defender
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
@ -278,6 +297,7 @@ function Checks
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -297,18 +317,6 @@ function Checks
$Script:DefenderproductState = $false
}
# Checking services
try
{
$Services = Get-Service -Name Windefend, SecurityHealthService, wscsvc -ErrorAction Stop
}
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Specifies whether Antispyware protection is enabled
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{
@ -329,13 +337,47 @@ function Checks
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
}
else
@ -4221,68 +4263,6 @@ public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint
}
[WinAPI.SystemParamInfo]::SystemParametersInfo(0x0057, 0, $null, 0)
}
<#
.SYNOPSIS
Files and folders grouping
.PARAMETER None
Do not group files and folder
.PARAMETER Default
Group files and folder by date modified (default value)
.EXAMPLE
FolderGroupBy -None
.EXAMPLE
FolderGroupBy -Default
.NOTES
Current user
#>
function FolderGroupBy
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "None"
)]
[switch]
$None,
[Parameter(
Mandatory = $true,
ParameterSetName = "Default"
)]
[switch]
$Default
)
switch ($PSCmdlet.ParameterSetName)
{
"None"
{
# Clear any Common Dialog views
Get-ChildItem -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\*\Shell" -Recurse | Where-Object -FilterScript {$_.PSChildName -eq "{885A186E-A440-4ADA-812B-DB871B942259}"} | Remove-Item -Force
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}"))
{
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name ColumnList -PropertyType String -Value "prop:0(34)System.ItemNameDisplay;0System.DateModified;0System.ItemTypeText;0System.Size;1System.DateCreated;1System.Author;1System.Category;1System.Keywords;1System.Title" -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name LogicalViewMode -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Name -PropertyType String -Value NoName -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Order -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name SortByList -PropertyType String -Value "prop:System.ItemNameDisplay" -Force
}
"Default"
{
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}" -Recurse -Force -ErrorAction Ignore
}
}
}
#endregion UI & Personalization
#region OneDrive
@ -10121,7 +10101,10 @@ function UninstallUWPApps
"Microsoft.HEVCVideoExtension",
# HEIF Image Extensions
"Microsoft.HEIFImageExtension"
"Microsoft.HEIFImageExtension",
# MPEG-2 Video Extension
"Microsoft.MPEG2VideoExtension"
)
#region Variables

16
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10"
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -567,14 +567,6 @@ Cursors -Dark
# Set default cursors (default value)
# Установить курсоры по умолчанию (значение по умолчанию)
# Cursors -Default
# Do not group files and folder
# Не группировать файлы и папки
# FolderGroupBy -None
# Group files and folder by date modified (default value)
# Группировать файлы и папки по дате изменения (значение по умолчанию)
# FolderGroupBy -Default
#endregion UI & Personalization
#region OneDrive
@ -966,7 +958,7 @@ UninstallPCHealthCheck
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.4.6
Date: 04.12.2022
Version: v5.4.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.4.6'
ModuleVersion = '5.4.7'
GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2023 farag & Inestic. All rights reserved'

135
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.4.6
Date: 04.12.2022
Version: v5.4.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -60,6 +60,7 @@ function Checks
if (-not [System.Environment]::Is64BitOperatingSystem)
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -261,24 +262,13 @@ function Checks
exit
}
# Check Microsoft Defender state
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
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
}
# Checking services
try
{
@ -287,10 +277,23 @@ function Checks
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Check Microsoft Defender state
$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
}
# Specifies whether Antispyware protection is enabled
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).AntispywareEnabled)
{
@ -302,13 +305,47 @@ function Checks
}
# 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).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
@ -3193,68 +3230,6 @@ public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint
}
[WinAPI.SystemParamInfo]::SystemParametersInfo(0x0057, 0, $null, 0)
}
<#
.SYNOPSIS
Files and folders grouping
.PARAMETER None
Do not group files and folder
.PARAMETER Default
Group files and folder by date modified (default value)
.EXAMPLE
FolderGroupBy -None
.EXAMPLE
FolderGroupBy -Default
.NOTES
Current user
#>
function FolderGroupBy
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "None"
)]
[switch]
$None,
[Parameter(
Mandatory = $true,
ParameterSetName = "Default"
)]
[switch]
$Default
)
switch ($PSCmdlet.ParameterSetName)
{
"None"
{
# Clear any Common Dialog views
Get-ChildItem -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\*\Shell" -Recurse | Where-Object -FilterScript {$_.PSChildName -eq "{885A186E-A440-4ADA-812B-DB871B942259}"} | Remove-Item -Force
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}"))
{
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name ColumnList -PropertyType String -Value "prop:0(34)System.ItemNameDisplay;0System.DateModified;0System.ItemTypeText;0System.Size;1System.DateCreated;1System.Author;1System.Category;1System.Keywords;1System.Title" -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name LogicalViewMode -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Name -PropertyType String -Value NoName -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Order -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name SortByList -PropertyType String -Value "prop:System.ItemNameDisplay" -Force
}
"Default"
{
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}" -Recurse -Force -ErrorAction Ignore
}
}
}
#endregion UI & Personalization
#region System

16
src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2019"
Version: v5.4.6
Date: 04.12.2022
Version: v5.4.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -439,14 +439,6 @@ Cursors -Dark
# Set default cursors (default value)
# Установить курсоры по умолчанию (значение по умолчанию)
# Cursors -Default
# Do not group files and folder
# Не группировать файлы и папки
# FolderGroupBy -None
# Group files and folder by date modified (default value)
# Группировать файлы и папки по дате изменения (значение по умолчанию)
# FolderGroupBy -Default
#endregion UI & Personalization
#region System
@ -767,7 +759,7 @@ ActiveHours -Automatically
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet

6
src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.6'
ModuleVersion = '5.14.7'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2023 farag & Inestic. All rights reserved'

111
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -60,6 +60,7 @@ function Checks
if (-not [System.Environment]::Is64BitOperatingSystem)
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -265,6 +266,7 @@ function Checks
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -287,6 +289,7 @@ function Checks
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
@ -302,13 +305,47 @@ function Checks
}
# 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).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
@ -3564,68 +3601,6 @@ public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, uint
}
[WinAPI.SystemParamInfo]::SystemParametersInfo(0x0057, 0, $null, 0)
}
<#
.SYNOPSIS
Files and folders grouping
.PARAMETER None
Do not group files and folder
.PARAMETER Default
Group files and folder by date modified (default value)
.EXAMPLE
FolderGroupBy -None
.EXAMPLE
FolderGroupBy -Default
.NOTES
Current user
#>
function FolderGroupBy
{
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "None"
)]
[switch]
$None,
[Parameter(
Mandatory = $true,
ParameterSetName = "Default"
)]
[switch]
$Default
)
switch ($PSCmdlet.ParameterSetName)
{
"None"
{
# Clear any Common Dialog views
Get-ChildItem -Path "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\*\Shell" -Recurse | Where-Object -FilterScript {$_.PSChildName -eq "{885A186E-A440-4ADA-812B-DB871B942259}"} | Remove-Item -Force
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}"))
{
New-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Force
}
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name ColumnList -PropertyType String -Value "prop:0(34)System.ItemNameDisplay;0System.DateModified;0System.ItemTypeText;0System.Size;1System.DateCreated;1System.Author;1System.Category;1System.Keywords;1System.Title" -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name LogicalViewMode -PropertyType DWord -Value 1 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Name -PropertyType String -Value NoName -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name Order -PropertyType DWord -Value 0 -Force
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}\TopViews\{00000000-0000-0000-0000-000000000000}" -Name SortByList -PropertyType String -Value "prop:System.ItemNameDisplay" -Force
}
"Default"
{
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{885a186e-a440-4ada-812b-db871b942259}" -Recurse -Force -ErrorAction Ignore
}
}
}
#endregion UI & Personalization
#region System

16
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2021"
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -494,14 +494,6 @@ Cursors -Dark
# Set default cursors (default value)
# Установить курсоры по умолчанию (значение по умолчанию)
# Cursors -Default
# Do not group files and folder
# Не группировать файлы и папки
# FolderGroupBy -None
# Group files and folder by date modified (default value)
# Группировать файлы и папки по дате изменения (значение по умолчанию)
# FolderGroupBy -Default
#endregion UI & Personalization
#region System
@ -865,7 +857,7 @@ RestartDeviceAfterUpdate -Enable
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet

6
src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.6 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.7 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1

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

55
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -60,6 +60,7 @@ function Checks
if (-not [System.Environment]::Is64BitOperatingSystem)
{
Write-Warning -Message $Localization.UnsupportedOSBitness
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -193,6 +194,7 @@ function Checks
if (($PendingActions | Test-Path) -contains $true)
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -278,6 +280,7 @@ function Checks
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -305,6 +308,7 @@ function Checks
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
@ -329,13 +333,47 @@ function Checks
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name EditionID) -ne "EnterpriseG")
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
}
else
@ -10077,7 +10115,10 @@ function UninstallUWPApps
"Microsoft.HEVCVideoExtension",
# HEIF Image Extensions
"Microsoft.HEIFImageExtension"
"Microsoft.HEIFImageExtension",
# MPEG-2 Video Extension
"Microsoft.MPEG2VideoExtension"
)
#region Variables

16
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10 (PowerShell 7)"
Version: v5.14.6
Date: 04.12.2022
Version: v5.14.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -70,7 +70,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.6 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.7 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -576,14 +576,6 @@ Cursors -Dark
# Set default cursors (default value)
# Установить курсоры по умолчанию (значение по умолчанию)
# Cursors -Default
# Do not group files and folder
# Не группировать файлы и папки
# FolderGroupBy -None
# Group files and folder by date modified (default value)
# Группировать файлы и папки по дате изменения (значение по умолчанию)
# FolderGroupBy -Default
#endregion UI & Personalization
#region OneDrive
@ -975,7 +967,7 @@ UninstallPCHealthCheck
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet

6
src/Sophia_Script_for_Windows_11/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

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

@ -13,6 +13,7 @@ RebootPending = The PC is waiting to be restarted
UnsupportedRelease = A new version found
CustomizationWarning = \nHave you customized every function in the {0} preset file before running Sophia Script?
WindowsBroken = Some Windows components may have been broken
UpdateDefender = Microsoft Defender definitions are out-of-date. Run Windows Update
ControlledFolderAccessDisabled = Controlled folder access disabled
ScheduledTasks = Scheduled tasks
OneDriveUninstalling = Uninstalling OneDrive...

2
src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '6.2.6'
ModuleVersion = '6.2.7'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2023 farag & Inestic. All rights reserved'

88
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -78,6 +78,9 @@ function Checks
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
@ -108,6 +111,9 @@ function Checks
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
@ -215,6 +221,7 @@ function Checks
if (($PendingActions | Test-Path) -contains $true)
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -288,24 +295,13 @@ function Checks
exit
}
# Check Microsoft Defender state
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
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
}
# Checking services
try
{
@ -314,11 +310,24 @@ function Checks
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Specifies whether Antispyware protection is enabled
# Check Microsoft Defender state
$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
}
# Specify whether Antispyware protection is enabled
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).AntispywareEnabled)
{
$Script:DefenderAntispywareEnabled = $true
@ -329,13 +338,47 @@ function Checks
}
# 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).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
@ -443,6 +486,8 @@ function Checks
Start-Sleep -Seconds 5
Start-Process -FilePath "https://github.com/farag2/Sophia-Script-for-Windows#how-to-use"
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
"1"
@ -9503,7 +9548,10 @@ function UninstallUWPApps
"Microsoft.RawImageExtension",
# HEIF Image Extensions
"Microsoft.HEIFImageExtension"
"Microsoft.HEIFImageExtension",
# MPEG-2 Video Extension
"Microsoft.MPEG2VideoExtension"
)
#region Variables

12
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 11"
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -509,7 +509,7 @@ Cursors -Dark
# Do not group files and folder
# Не группировать файлы и папки
# FolderGroupBy -None
FolderGroupBy -None
# Group files and folder by date modified (default value)
# Группировать файлы и папки по дате изменения (значение по умолчанию)
@ -902,8 +902,8 @@ DefaultTerminalApp -WindowsTerminal
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6, 7 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet
#>

6
src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -50,7 +50,7 @@ function Sophia
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.6 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.7 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

2
src/Sophia_Script_for_Windows_11_PowerShell_7/Manifest/Sophia.psd1

@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '6.2.6'
ModuleVersion = '6.2.7'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2023 farag & Inestic. All rights reserved'

89
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -62,7 +62,7 @@ function Checks
{
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 1335)
{
# Check whether the OS minor build version is 963 minimum
# Check whether the OS minor build version is 1335 minimum
# https://docs.microsoft.com/en-us/windows/release-health/windows11-release-information
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion"
Write-Warning -Message ($Localization.UpdateWarning -f $Version.CurrentBuild, $Version.UBR)
@ -78,6 +78,9 @@ function Checks
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
@ -92,7 +95,7 @@ function Checks
{
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion" -Name UBR) -lt 963)
{
# Check whether the OS minor build version is 963 minimum
# Check whether the OS minor build version is 1335 minimum
# https://docs.microsoft.com/en-us/windows/release-health/windows11-release-information
$Version = Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion"
Write-Warning -Message ($Localization.UpdateWarning -f $Version.CurrentBuild, $Version.UBR)
@ -108,6 +111,9 @@ function Checks
Get-CimInstance -Namespace "Root\cimv2\mdm\dmmap" -ClassName "MDM_EnterpriseModernAppManagement_AppManagement01" | Invoke-CimMethod -MethodName UpdateScanMethod
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
@ -215,6 +221,7 @@ function Checks
if (($PendingActions | Test-Path) -contains $true)
{
Write-Warning -Message $Localization.RebootPending
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
@ -292,20 +299,10 @@ function Checks
if ($null -eq (Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct -ErrorAction Ignore))
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
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
}
# Checking services
try
{
@ -314,11 +311,24 @@ function Checks
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
$Localization.WindowsBroken
Start-Process -FilePath "https://t.me/sophia_chat"
exit
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Specifies whether Antispyware protection is enabled
# Check Microsoft Defender state
$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
}
# Specify whether Antispyware protection is enabled
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).AntispywareEnabled)
{
$Script:DefenderAntispywareEnabled = $true
@ -329,13 +339,47 @@ function Checks
}
# 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).ProductStatus -eq 1)
try
{
$Script:DefenderProductStatus = $false
if ($Script:DefenderproductState)
{
if ((Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender).ProductStatus -eq 1)
{
$Script:DefenderProductStatus = $false
}
else
{
$Script:DefenderProductStatus = $true
}
}
else
{
$Script:DefenderProductStatus = $false
}
}
else
catch [System.Management.Automation.PropertyNotFoundException]
{
$Script:DefenderProductStatus = $true
$Localization.UpdateDefender ###
Start-Process -FilePath "https://t.me/sophia_chat"
# Enable receiving updates for other Microsoft products when you update Windows
(New-Object -ComObject Microsoft.Update.ServiceManager).AddService2("7971f918-a847-4430-9279-4a52d1efe18d", 7, "")
Start-Sleep -Seconds 1
# Open the "Windows Update" page
Start-Process -FilePath "ms-settings:windowsupdate"
# Check for updates
Start-Process -FilePath "ms-settings:windowsupdate-action"
Start-Sleep -Seconds 1
# Trigger Windows Update for detecting new updates
(New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow()
exit
}
# https://docs.microsoft.com/en-us/graph/api/resources/intune-devices-windowsdefenderproductstatus?view=graph-rest-beta
@ -9521,7 +9565,10 @@ function UninstallUWPApps
"Microsoft.RawImageExtension",
# HEIF Image Extensions
"Microsoft.HEIFImageExtension"
"Microsoft.HEIFImageExtension",
# MPEG-2 Video Extension
"Microsoft.MPEG2VideoExtension"
)
#region Variables

8
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 11 (PowerShell 7)"
Version: v6.2.6
Date: 04.12.2022
Version: v6.2.7
Date: 07.01.2023
Copyright (c) 20142023 farag
Copyright (c) 20192023 farag & Inestic
@ -69,7 +69,7 @@ param
Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.6 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.7 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2023"
Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -911,7 +911,7 @@ DefaultTerminalApp -WindowsTerminal
InstallVCRedist
<#
Install the latest .NET Desktop Runtime 7 (x86/x64)
Install the latest .NET Desktop Runtime 6, 7 (x86/x64)
Установить последнюю версию .NET Desktop Runtime 6 (x86/x64)
https://dotnet.microsoft.com/en-us/download/dotnet

Loading…
Cancel
Save