Skip to content

Commit

Permalink
Added Windows 11 Enterprise LTSC 2024 support
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 4, 2024
1 parent 2284f55 commit 32f6429
Show file tree
Hide file tree
Showing 26 changed files with 16,112 additions and 25 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/Sophia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
run: |
. "Scripts\Windows_11_PS_7.ps1"
- name: Sophia Script for Windows 11 LTSC 2024
run: |
. "Scripts\Windows_11_LTSC_2024.ps1"
- name: Sophia Script Wrapper
run: |
. "Scripts\Wrapper.ps1"
Expand Down Expand Up @@ -76,6 +80,7 @@ jobs:
$Sophia_Script_Windows_10_LTSC2021 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_10_LTSC2021
$Sophia_Script_Windows_11_PowerShell_5_1 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_5_1
$Sophia_Script_Windows_11_PowerShell_7 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_PowerShell_7
$Sophia_Script_Windows_11_LTSC2024 = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024
$Sophia_Script_Wrapper = (Invoke-RestMethod @Parameters).Sophia_Script_Wrapper
# Replace variables with script latest versions
Expand All @@ -89,6 +94,7 @@ jobs:
-replace "Sophia_Script_Windows_10_LTSC2021", $Sophia_Script_Windows_10_LTSC2021 `
-replace "Sophia_Script_Windows_11_PowerShell_5_1", $Sophia_Script_Windows_11_PowerShell_5_1 `
-replace "Sophia_Script_Windows_11_PowerShell_7", $Sophia_Script_Windows_11_PowerShell_7 `
-replace "Sophia_Script_Windows_11_LTSC2024", $Sophia_Script_Windows_11_LTSC2024 `
-replace "Sophia_Script_Wrapper", $Sophia_Script_Wrapper
} | Set-Content -Path ReleaseNotesTemplate.md -Encoding utf8 -Force
Expand Down
32 changes: 32 additions & 0 deletions Scripts/Windows_11_LTSC_2024.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# https://github.com/farag2/Sophia-Script-for-Windows/blob/master/sophia_script_versions.json
$Parameters = @{
Uri = "https://raw.githubusercontent.com/farag2/Sophia-Script-for-Windows/master/sophia_script_versions.json"
}
$LatestRelease = (Invoke-RestMethod @Parameters).Sophia_Script_Windows_11_LTSC2024

Write-Verbose -Message "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" -Verbose

New-Item -Path "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease\bin" -ItemType Directory -Force

$Parameters = @{
Path = @("Scripts\LGPO.exe")
Destination = "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease\bin"
Recurse = $true
Force = $true
}
Copy-Item @Parameters

Get-ChildItem -Path "src\Sophia_Script_for_Windows_11_LTSC_2024" -Force | Copy-Item -Destination "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease" -Recurse -Force

$Parameters = @{
Path = "Sophia_Script_for_Windows_11_LTSC_2024_v$LatestRelease"
DestinationPath = "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip"
CompressionLevel = "Fastest"
Force = $true
}
Compress-Archive @Parameters

# Calculate hash
Get-Item -Path "Sophia.Script.for.Windows.11.LTSC.2024.v$LatestRelease.zip" -Force | ForEach-Object -Process {
"$($_.Name) $((Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash)"
} | Add-Content -Path SHA256SUM -Encoding utf8 -Force
3 changes: 0 additions & 3 deletions src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -6323,9 +6323,6 @@ function WindowsCapabilities
# Steps Recorder
"App.StepsRecorder*",

# Microsoft Quick Assist
"App.Support.QuickAssist*",

# Microsoft Paint
"Microsoft.Windows.MSPaint*",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
Thanks to all https://forum.ru-board.com members involved
.NOTES
Supported Windows 10 version
Version: 1809
Edition: Enterprise LTSC
Supported Windows 10 Enterprise LTSC 2019
Architecture: x64
.LINK GitHub
Expand Down
4 changes: 1 addition & 3 deletions src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
irm script.sophi.app -useb | iex
.NOTES
Supported Windows 10 version
Version: 1809
Edition: Enterprise LTSC 2019
Supported Windows 10 Enterprise LTSC 2019
Architecture: x64
.NOTES
Expand Down
6 changes: 2 additions & 4 deletions src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
Thanks to all https://forum.ru-board.com members involved
.NOTES
Supported Windows 10 version
Version: 21H2
Edition: Enterprise LTSC 2021
Supported Windows 10 Enterprise LTSC 2021
Architecture: x64
.LINK GitHub
Expand Down Expand Up @@ -1706,7 +1704,7 @@ function ScheduledTasks
Add-Type -AssemblyName System.Windows.Forms

# We cannot use Get-Process -Id $PID as script might be invoked via Terminal with different $PID
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC")} | ForEach-Object -Process {
Get-Process | Where-Object -FilterScript {(($_.ProcessName -eq "powershell") -or ($_.ProcessName -eq "WindowsTerminal")) -and ($_.MainWindowTitle -match "Sophia Script for Windows 10 LTSC 2021")} | ForEach-Object -Process {
# Show window, if minimized
[WinAPI.ForegroundWindow]::ShowWindowAsync($_.MainWindowHandle, 10)

Expand Down
4 changes: 1 addition & 3 deletions src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
irm script.sophi.app -useb | iex
.NOTES
Supported Windows 10 version
Version: 21H2
Edition: Enterprise LTSC 2021
Supported Windows 10 Enterprise LTSC 2021
Architecture: x64
.NOTES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6335,9 +6335,6 @@ function WindowsCapabilities
# Steps Recorder
"App.StepsRecorder*",

# Microsoft Quick Assist
"App.Support.QuickAssist*",

# Microsoft Paint
"Microsoft.Windows.MSPaint*",

Expand Down
3 changes: 0 additions & 3 deletions src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5916,9 +5916,6 @@ function WindowsCapabilities
# Steps Recorder
"App.StepsRecorder*",

# Microsoft Quick Assist
"App.Support.QuickAssist*",

# WordPad
"Microsoft.Windows.WordPad*"
)
Expand Down
196 changes: 196 additions & 0 deletions src/Sophia_Script_for_Windows_11_LTSC_2024/Functions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<#
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v6.6.9
Date: 04.10.2024
Copyright (c) 2014—2024 farag, Inestic & lowl1f3
Thanks to all https://forum.ru-board.com members involved
.DESCRIPTION
Dot source the script first: . .\Function.ps1 (with a dot at the beginning)
Start typing any characters contained in the function's name or its arguments, and press the TAB button
.EXAMPLE
Sophia -Functions <tab>
Sophia -Functions temp<tab>
Sophia -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
.NOTES
Use commas to separate funtions
.LINK
https://github.com/farag2/Sophia-Script-for-Windows
#>

#Requires -RunAsAdministrator
#Requires -Version 5.1

function Sophia
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
[string[]]
$Functions
)

foreach ($Function in $Functions)
{
Invoke-Expression -Command $Function
}

# The "PostActions" and "Errors" functions will be executed at the end
Invoke-Command -ScriptBlock {PostActions; Errors}
}

Clear-Host

$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.6.9 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"

Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

Import-LocalizedData -BindingVariable Global:Localization -FileName Sophia -BaseDirectory $PSScriptRoot\Localizations

# The mandatory checks. Please, do not comment out this function
InitialActions

$Parameters = @{
CommandName = "Sophia"
ParameterName = "Functions"
ScriptBlock = {
param
(
$commandName,
$parameterName,
$wordToComplete,
$commandAst,
$fakeBoundParameters
)

# Get functions list with arguments to complete
$Commands = (Get-Module -Name Sophia).ExportedCommands.Keys
foreach ($Command in $Commands)
{
$ParameterSets = (Get-Command -Name $Command).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}

# If a module command is OneDrive
if ($Command -eq "OneDrive")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}

# Get all command arguments, excluding defaults
foreach ($ParameterSet in $ParameterSets.Name)
{
# If an argument is AllUsers
if ($ParameterSet -eq "AllUsers")
{
# The "OneDrive -Install -AllUsers" construction
"OneDrive" + " " + "-Install" + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}

continue
}
}

# If a module command is UninstallUWPApps
if ($Command -eq "UninstallUWPApps")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}

# Get all command arguments, excluding defaults
foreach ($ParameterSet in $ParameterSets.Name)
{
# If an argument is ForAllUsers
if ($ParameterSet -eq "ForAllUsers")
{
# The "UninstallUWPApps -ForAllUsers" construction
"UninstallUWPApps" + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}

continue
}
}

# If a module command is InstallDotNetRuntimes
if ($Command -eq "InstallDotNetRuntimes")
{
# Get all command arguments, excluding defaults
foreach ($ParameterSet in $ParameterSets.Name)
{
# If an argument is Runtimes
if ($ParameterSet -eq "Runtimes")
{
$ValidValues = ((Get-Command -Name InstallDotNetRuntimes).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues
foreach ($ValidValue in $ValidValues)
{
# The "InstallDotNetRuntimes -Runtimes <function>" construction
"InstallDotNetRuntimes" + " " + "-" + $ParameterSet + " " + $ValidValue | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}

# The "InstallDotNetRuntimes -Runtimes <functions>" construction
"InstallDotNetRuntimes" + " " + "-" + $ParameterSet + " " + ($ValidValues -join ", ") | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}

continue
}
}

# If a module command is DNSoverHTTPS
if ($Command -eq "DNSoverHTTPS")
{
(Get-Command -Name $Command).Name | Where-Object -FilterScript {$_ -like "*$wordToComplete*"}

# Get the valid IPv4 addresses array
# ((Get-Command -Name DNSoverHTTPS).Parametersets.Parameters | Where-Object -FilterScript {$null -eq $_.Attributes.AliasNames}).Attributes.ValidValues | Select-Object -Unique
$ValidValues = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValue in $ValidValues)
{
$ValidValuesDescending = @((Get-ChildItem -Path HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\DohWellKnownServers).PSChildName) | Where-Object {$_ -notmatch ":"}
foreach ($ValidValueDescending in $ValidValuesDescending)
{
# The "DNSoverHTTPS -Enable -PrimaryDNS x.x.x.x -SecondaryDNS x.x.x.x" construction
"DNSoverHTTPS -Enable -PrimaryDNS $ValidValue -SecondaryDNS $ValidValueDescending" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
}
}

"DNSoverHTTPS -Disable" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}
"DNSoverHTTPS -ComssOneDNS" | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}

continue
}

# If a module command is Set-Policy
if ($Command -eq "Set-Policy")
{
continue
}

foreach ($ParameterSet in $ParameterSets.Name)
{
# The "Function -Argument" construction
$Command + " " + "-" + $ParameterSet | Where-Object -FilterScript {$_ -like "*$wordToComplete*"} | ForEach-Object -Process {"`"$_`""}

continue
}

# Get functions list without arguments to complete
Get-Command -Name $Command | Where-Object -FilterScript {$null -eq $_.Parametersets.Parameters} | Where-Object -FilterScript {$_.Name -like "*$wordToComplete*"}

continue
}
}
}
Register-ArgumentCompleter @Parameters

Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Sophia -Functions <tab>" -Verbose
Write-Verbose -Message "Sophia -Functions temp<tab>" -Verbose
Write-Verbose -Message "Sophia -Functions `"DiagTrackService -Disable`", `"DiagnosticDataLevel -Minimal`", UninstallUWPApps" -Verbose
Write-Information -MessageData "" -InformationAction Continue
Write-Verbose -Message "Sophia -Functions `"UninstallUWPApps, `"PinToStart -UnpinAll`" -Verbose"
Write-Verbose -Message "Sophia -Functions `"Set-Association -ProgramPath ```"%ProgramFiles%\Notepad++\notepad++.exe```" -Extension .txt -Icon ```"%ProgramFiles%\Notepad++\notepad++.exe,0```"`"" -Verbose
Loading

0 comments on commit 32f6429

Please sign in to comment.