Browse Source

Added choco package installer

pull/625/head
Dmitry Nefedov 3 months ago
parent
commit
f22ef405d8
  1. 2
      Download_Latest_Sophia.ps1
  2. 2
      Download_Sophia.ps1
  3. 27
      chocolatey/sophia.nuspec
  4. 10
      chocolatey/tools/LICENSE.txt
  5. 7
      chocolatey/tools/VERIFICATION.txt
  6. 196
      chocolatey/tools/chocolateyinstall.ps1
  7. 29
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  8. 29
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  9. 29
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  10. 29
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  11. 29
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  12. 29
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

2
Download_Latest_Sophia.ps1

@ -115,7 +115,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 PowerShell 7 | Latest | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
}
}
{$_ -ge 22631}
{$_ -ge 26100}
{
# Check for Windows 11 LTSC 2024
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -notmatch "LTSC 2024")

2
Download_Sophia.ps1

@ -171,7 +171,7 @@ switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
$Version = "Windows_10_PowerShell_7"
}
}
{$_ -ge 22631}
{$_ -ge 26100}
{
# Check for Windows 11 LTSC 2024
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -notmatch "LTSC 2024")

27
chocolatey/sophia.nuspec

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>sophia</id>
<version>6.8.3</version>
<packageSourceUrl>https://github.com/farag2/Sophia-Script-for-Windows</packageSourceUrl>
<owners>Team Sophia</owners>
<title>Sophia Script for Windows</title>
<authors>Team Sophia</authors>
<projectUrl>https://github.com/farag2/Sophia-Script-for-Windows</projectUrl>
<iconUrl>https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/refs/heads/master/img/Sophia.png</iconUrl>
<copyright>Copyright (c) 2014—2025 Team Sophia</copyright>
<licenseUrl>https://github.com/farag2/Sophia-Script-for-Windows/blob/master/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/farag2/Sophia-Script-for-Windows</projectSourceUrl>
<docsUrl>https://github.com/farag2/Sophia-Script-for-Windows/blob/master/README.md</docsUrl>
<bugTrackerUrl>https://github.com/farag2/Sophia-Script-for-Windows/issues</bugTrackerUrl>
<tags>windows gui script powershell tweaks windows-10 sophia tweaker tweak debloat debloating ltsc windows-11 debloater windows-debloat sophia-script 22h2 23h2 24h2 </tags>
<summary>The most powerful PowerShell module on GitHub for Windows 10 and Windows 11 fine-tuning and tweaking</summary>
<description>Sophia Script for Windows is the largest PowerShell module on GitHub for Windows 10 and Windows 11 fine-tuning and automating the routine tasks</description>
<releaseNotes>https://github.com/farag2/Sophia-Script-for-Windows/blob/master/CHANGELOG.md</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>

10
chocolatey/tools/LICENSE.txt

@ -0,0 +1,10 @@
From: https://github.com/farag2/Sophia-Script-for-Windows/blob/master/LICENSE
LICENSE
The MIT License (MIT)
Copyright (c) 2014—2025 Team Sophia
LGPO.exe is developed by Microsoft Corporation
License: https://www.microsoft.com/en-us/download/details.aspx?id=55319

7
chocolatey/tools/VERIFICATION.txt

@ -0,0 +1,7 @@
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.
This package is published by Team Sophia, the developers of Sophia Script for Windows.
Any files will be identical to other package types published by the project as all binaries are downloaded via Ci/CD:
https://github.com/farag2/Sophia-Script-for-Windows/blob/master/.github/workflows/Sophia.yml

196
chocolatey/tools/chocolateyinstall.ps1

@ -0,0 +1,196 @@
<#
.SYNOPSIS
Get direct URL of Sophia Script archive, depending on which Windows or PowerShell versions are used to
.SYNOPSIS
For example, if you start script on Windows 11 via PowerShell 5.1 you will start downloading Sophia Script for Windows 11 PowerShell 5.1
#>
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
if ($Host.Version.Major -eq 5)
{
# Progress bar can significantly impact cmdlet performance
# https://github.com/PowerShell/PowerShell/issues/2138
$Script:ProgressPreference = "SilentlyContinue"
}
$Parameters = @{
Uri = "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest"
UseBasicParsing = $true
}
$LatestGitHubRelease = (Invoke-RestMethod @Parameters).tag_name
if (-not $LatestGitHubRelease)
{
Write-Warning -Message "https://api.github.com/repos/farag2/Sophia-Script-for-Windows/releases/latest is unreachable. Please fix connection or change your DNS records."
Write-Information -MessageData "" -InformationAction Continue
if ((Get-CimInstance -ClassName CIM_ComputerSystem).HypervisorPresent)
{
$DNS = (Get-NetRoute | Where-Object -FilterScript {$_.DestinationPrefix -eq "0.0.0.0/0"} | Get-NetAdapter | Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses
}
else
{
$DNS = (Get-NetAdapter -Physical | Get-NetIPInterface -AddressFamily IPv4 | Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses
}
Write-Warning -Message "Your DNS are $(if ($DNS.Count -gt 1) {$DNS -join ', '} else {$DNS})"
pause
exit
}
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
UseBasicParsing = $true
}
$JSONVersions = Invoke-RestMethod @Parameters
switch ((Get-CimInstance -ClassName Win32_OperatingSystem).BuildNumber)
{
"17763"
{
# Check for Windows 10 LTSC 2019
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -match "LTSC 2019")
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2019
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2019.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
$Version = "Windows_10_LTSC2019"
}
else
{
Write-Verbose -Message "Windows version is not supported. Update your Windows" -Verbose
# 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"
pause
exit
}
}
"19044"
{
# Check for Windows 10 LTSC 2021
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -match "LTSC 2021")
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_LTSC2021
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.LTSC.2021.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
else
{
Write-Verbose -Message "Windows version is not supported. Update your Windows" -Verbose
# 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"
pause
exit
}
}
"19045"
{
if ($Host.Version.Major -eq 5)
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_10_PowerShell_5_1
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
else
{
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_PowerShell_7
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.10.PowerShell.7.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
}
{$_ -ge 22631}
{
# Check for Windows 11 LTSC 2024
if ((Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName) -notmatch "LTSC 2024")
{
if ($Host.Version.Major -eq 5)
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_5_1
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
else
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_PowerShell_7
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.PowerShell.7.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
}
else
{
$LatestRelease = $JSONVersions.Sophia_Script_Windows_11_LTSC2024
$URL = "https://github.com/farag2/Sophia-Script-for-Windows/releases/download/$LatestGitHubRelease/Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip"
$Parameters = @{
Uri = $URL
OutFile = "$DownloadsFolder\Sophia.Script.zip"
UseBasicParsing = $true
Verbose = $true
}
Invoke-WebRequest @Parameters
}
}
}
# Downloads folder
$Downloads = Get-ItemPropertyValue -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "{374DE290-123F-4565-9164-39C4925E467B}"
$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $Downloads
url = $URL
}
Install-ChocolateyZipPackage @packageArgs

29
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -570,6 +570,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

29
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -542,6 +542,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

29
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -542,6 +542,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

29
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -597,6 +597,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

29
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -557,6 +557,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [System.ComponentModel.Win32Exception]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

29
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -584,6 +584,35 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
$Script:DefenderServices = ($Services | Where-Object -FilterScript {$_.Status -ne "running"} | Measure-Object).Count -lt $Services.Count
# Checking wdFilter service
try
{
if ((Get-Service -Name wdFilter -ErrorAction Stop).Status -ne "Running")
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
}
catch [Microsoft.PowerShell.Commands.ServiceCommandException]
{
Write-Information -MessageData "" -InformationAction Continue
Write-Warning -Message ($Localization.WindowsComponentBroken -f "Microsoft Defender")
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "https://www.microsoft.com/software-download/windows11" -Verbose
Write-Verbose -Message "https://t.me/sophia_chat" -Verbose
Write-Verbose -Message "https://discord.gg/sSryhaEv79" -Verbose
exit
}
# Checking Get-MpPreference cmdlet
try
{

Loading…
Cancel
Save