Browse Source

Added Wrapper 2.7.3

master
Dmitry Nefedov 3 months ago
parent
commit
8be277ef9d
  1. 381
      Wrapper/Config/config_Windows_11_LTSC.json
  2. BIN
      Wrapper/SophiaScriptWrapper.exe
  3. 32
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  4. 20
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  5. 32
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  6. 32
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  7. 32
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  8. 32
      src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1
  9. 32
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

381
Wrapper/Config/config_Windows_11_LTSC.json

File diff suppressed because it is too large

BIN
Wrapper/SophiaScriptWrapper.exe

Binary file not shown.

32
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -12176,20 +12176,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -12423,6 +12421,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -12577,6 +12580,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -12901,6 +12909,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -13225,6 +13238,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

20
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -9214,6 +9214,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -9368,6 +9373,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -9692,6 +9702,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -10016,6 +10031,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

32
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -10100,20 +10100,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -10347,6 +10345,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -10501,6 +10504,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -10825,6 +10833,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -11149,6 +11162,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

32
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -12196,20 +12196,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -12443,6 +12441,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -12597,6 +12600,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -12921,6 +12929,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -13245,6 +13258,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

32
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -11345,20 +11345,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -11592,6 +11590,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -11746,6 +11749,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -12070,6 +12078,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -12394,6 +12407,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

32
src/Sophia_Script_for_Windows_11_LTSC_2024/Module/Sophia.psm1

@ -10633,20 +10633,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -10880,6 +10878,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -11034,6 +11037,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -11358,6 +11366,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -11682,6 +11695,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

32
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -11361,20 +11361,18 @@ function GPUScheduling
{ {
"Enable" "Enable"
{ {
if (Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}) # Determining whether PC has an external graphics card
{ $AdapterDACType = Get-CimInstance -ClassName CIM_VideoController | Where-Object -FilterScript {($_.AdapterDACType -ne "Internal") -and ($null -ne $_.AdapterDACType)}
# Determining whether an OS is not installed on a virtual machine # Determining whether an OS is not installed on a virtual machine
if ((Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual") $ComputerSystemModel = (Get-CimInstance -ClassName CIM_ComputerSystem).Model -notmatch "Virtual"
{
# Checking whether a WDDM verion is 2.7 or higher # Checking whether a WDDM verion is 2.7 or higher
$WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null) $WddmVersion_Min = [Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\FeatureSetUsage", "WddmVersion_Min", $null)
if ($WddmVersion_Min -ge 2700)
if ($AdapterDACType -and ($ComputerSystemModel -notmatch "Virtual") -and ($WddmVersion_Min -ge 2700))
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 2 -Force
} }
} }
}
}
"Disable" "Disable"
{ {
New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force New-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\GraphicsDrivers -Name HwSchMode -PropertyType DWord -Value 1 -Force
@ -11608,6 +11606,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work) # We have to call PowerShell script via another VBS script silently because VBS has appropriate feature to suppress console appearing (none of other workarounds work)
# powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast) # powershell.exe process wakes up system anyway even from turned on Focus Assist mode (not a notification toast)
# https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs # https://github.com/DCourtel/Windows_10_Focus_Assist/blob/master/FocusAssistLibrary/FocusAssistLib.cs
@ -11762,6 +11765,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Windows Cleanup Notification"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
# Start Task Scheduler in the end if any scheduled task was created # Start Task Scheduler in the end if any scheduled task was created
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
@ -12086,6 +12094,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "SoftwareDistribution"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"
@ -12410,6 +12423,11 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
} }
Register-ScheduledTask @Parameters -Force Register-ScheduledTask @Parameters -Force
# Set author for scheduled task
$Task = Get-ScheduledTask -TaskName "Temp"
$Task.Author = "Team Sophia"
$Task | Set-ScheduledTask
$Script:ScheduledTasks = $true $Script:ScheduledTasks = $true
} }
"Delete" "Delete"

Loading…
Cancel
Save