Browse Source

29.10.2022 6.2.1

pull/411/head
Dmitry Nefedov 3 years ago
parent
commit
b413c5ea40
  1. 12
      README.md
  2. 6
      src/Sophia_Script_for_Windows_10/Functions.ps1
  3. 2
      src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
  4. 150
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  5. 6
      src/Sophia_Script_for_Windows_10/Sophia.ps1
  6. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
  7. 2
      src/Sophia_Script_for_Windows_10_LTSC_2019/Manifest/Sophia.psd1
  8. 150
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  9. 6
      src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1
  10. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1
  11. 2
      src/Sophia_Script_for_Windows_10_LTSC_2021/Manifest/Sophia.psd1
  12. 150
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  13. 6
      src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1
  14. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1
  15. 2
      src/Sophia_Script_for_Windows_10_PowerShell_7/Manifest/Sophia.psd1
  16. 150
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  17. 6
      src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1
  18. 6
      src/Sophia_Script_for_Windows_11/Functions.ps1
  19. 2
      src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1
  20. 149
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  21. 6
      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. 157
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
  25. 15
      src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

12
README.md

@ -94,7 +94,7 @@ Sophia Script for Windows is the largest PowerShell module on `GitHub` for `Wind
## Screenshots ## Screenshots
### The TAB autocomplete. Read more [here](#how-to-run-the-specific-functions) ### The <kbd>TAB</kbd> autocomplete. Read more [here](#how-to-run-the-specific-functions)
![Image](./img/Autocomplete.gif) ![Image](./img/Autocomplete.gif)
@ -136,7 +136,7 @@ Sophia Script for Windows is the largest PowerShell module on `GitHub` for `Wind
* Set up UI & Personalization; * Set up UI & Personalization;
* Uninstall OneDrive "correctly"; * Uninstall OneDrive "correctly";
* Interactive [prompts](#change-user-folders-location-programmatically-using-the-interactive-menu); * Interactive [prompts](#change-user-folders-location-programmatically-using-the-interactive-menu);
* The [TAB](#the-tab-autocomplete-read-more-here) completion for functions and their arguments (if using the Functions.ps1 file); * The <kbd>TAB</kbd> [completion](#the-tab-autocomplete-read-more-here) for functions and their arguments (if using the Functions.ps1 file);
* Change %TEMP% environment variable path to %SystemDrive%\Temp * Change %TEMP% environment variable path to %SystemDrive%\Temp
* Change location of the user folders programmatically (without moving user files) within interactive menu using arrows to select a drive * Change location of the user folders programmatically (without moving user files) within interactive menu using arrows to select a drive
* "Desktop"; * "Desktop";
@ -216,10 +216,10 @@ To run the specific function(s) [dot source](https://docs.microsoft.com/ru-ru/po
* Now you can do like this (the quotation marks required) * Now you can do like this (the quotation marks required)
```powershell ```powershell
Sophia -Functions <tab> Sophia -Functions<kbd>TAB</kbd>
Sophia -Functions temp<tab> Sophia -Functions temp<kbd>TAB</kbd>
Sophia -Functions unin<tab> Sophia -Functions unin<kbd>TAB</kbd>
Sophia -Functions uwp<tab> Sophia -Functions uwp<kbd>TAB</kbd>
Sophia -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps Sophia -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
UninstallUWPApps, "PinToStart -UnpinAll" UninstallUWPApps, "PinToStart -UnpinAll"

6
src/Sophia_Script_for_Windows_10/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force 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' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.0' ModuleVersion = '5.14.1'
GUID = '109cc881-c42b-45af-a74a-550781989d6a' GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov' Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved' Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'

150
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -11279,14 +11279,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -11477,15 +11482,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11535,14 +11562,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -11599,7 +11631,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11649,14 +11705,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -11705,7 +11766,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -13499,6 +13584,7 @@ function UpdateLGPEPolicies
} }
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
# Local Machine policies paths to scan recursively # Local Machine policies paths to scan recursively

6
src/Sophia_Script_for_Windows_10/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10" Default preset file for "Sophia Script for Windows 10"
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -74,7 +74,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v5.4.0 Version: v5.4.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows 10 | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force 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' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.4.0' ModuleVersion = '5.4.1'
GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01' GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01'
Author = 'Dmitry "farag" Nefedov' Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved' Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'

150
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.4.0 Version: v5.4.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -7913,14 +7913,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -8111,15 +8116,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -8169,14 +8196,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -8233,7 +8265,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -8283,14 +8339,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -8339,7 +8400,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -9911,6 +9996,7 @@ function UpdateLGPEPolicies
} }
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
# Local Machine policies paths to scan recursively # Local Machine policies paths to scan recursively

6
src/Sophia_Script_for_Windows_10_LTSC_2019/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2019" Default preset file for "Sophia Script for Windows 10 LTSC 2019"
Version: v5.4.0 Version: v5.4.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -74,7 +74,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2019 v5.4.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

6
src/Sophia_Script_for_Windows_10_LTSC_2021/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force 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' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.0' ModuleVersion = '5.14.1'
GUID = '109cc881-c42b-45af-a74a-550781989d6a' GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov' Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved' Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'

150
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -9080,14 +9080,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -9278,15 +9283,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -9336,14 +9363,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -9400,7 +9432,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -9450,14 +9506,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -9506,7 +9567,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11132,6 +11217,7 @@ function UpdateLGPEPolicies
} }
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
# Local Machine policies paths to scan recursively # Local Machine policies paths to scan recursively

6
src/Sophia_Script_for_Windows_10_LTSC_2021/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10 LTSC 2021" Default preset file for "Sophia Script for Windows 10 LTSC 2021"
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -74,7 +74,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 LTSC 2021 v5.14.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

6
src/Sophia_Script_for_Windows_10_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.0 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.1 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force 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' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.0' ModuleVersion = '5.14.1'
GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a' GUID = 'aa0b47a7-1770-4b5d-8c9f-cc6c505bcc7a'
Author = 'Dmitry "farag" Nefedov' Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved' Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'

150
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -11317,14 +11317,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -11515,15 +11520,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11573,14 +11600,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -11637,7 +11669,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11687,14 +11743,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -11743,7 +11804,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -13539,6 +13624,7 @@ function UpdateLGPEPolicies
} }
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
# Local Machine policies paths to scan recursively # Local Machine policies paths to scan recursively

6
src/Sophia_Script_for_Windows_10_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 10 (PowerShell 7)" Default preset file for "Sophia Script for Windows 10 (PowerShell 7)"
Version: v5.14.0 Version: v5.14.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -74,7 +74,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.0 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.14.1 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

6
src/Sophia_Script_for_Windows_11/Functions.ps1

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

2
src/Sophia_Script_for_Windows_11/Manifest/Sophia.psd1

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

149
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.0 Version: v6.2.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -10662,14 +10662,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -10860,15 +10865,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -10918,14 +10945,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -10982,7 +11014,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11032,14 +11088,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -11088,7 +11149,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }

6
src/Sophia_Script_for_Windows_11/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 11" Default preset file for "Sophia Script for Windows 11"
Version: v6.2.0 Version: v6.2.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -73,7 +73,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

6
src/Sophia_Script_for_Windows_11_PowerShell_7/Functions.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
The TAB completion for functions and their arguments The TAB completion for functions and their arguments
Version: v6.2.0 Version: v6.2.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -54,7 +54,7 @@ function Sophia
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.0 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.1 | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force 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' RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '6.2.0' ModuleVersion = '6.2.1'
GUID = '109cc881-c42b-45af-a74a-550781989d6a' GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov' Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved' Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'

157
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v6.2.0 Version: v6.2.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -1571,13 +1571,13 @@ function AppsSilentInstalling
<# <#
.SYNOPSIS .SYNOPSIS
Suggestions on how I can set up my device Ways to get the most out of Windows and finish setting up this device
.PARAMETER Disable .PARAMETER Disable
Disable suggestions on how I can set up my device Do not suggest ways to get the most out of Windows and finish setting up this device
.PARAMETER Enable .PARAMETER Enable
Offer suggestions on how I can set up my device Suggest ways to get the most out of Windows and finish setting up this device
.EXAMPLE .EXAMPLE
WhatsNewInWindows -Disable WhatsNewInWindows -Disable
@ -3591,7 +3591,6 @@ function Cursors
} }
$ZIP.Dispose() $ZIP.Dispose()
Remove-Item -Path "$DownloadsFolder\Cursors.zip" -Force Remove-Item -Path "$DownloadsFolder\Cursors.zip" -Force
New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light HD v2.2 by Jepri Creations" -Force New-ItemProperty -Path "HKCU:\Control Panel\Cursors" -Name "(default)" -PropertyType String -Value "W11 Cursor Light HD v2.2 by Jepri Creations" -Force
@ -10701,14 +10700,19 @@ function CleanupTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
@ -10899,15 +10903,37 @@ while (`$true)
} }
"Delete" "Delete"
{ {
# Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process { Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
} }
Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore Remove-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel" -Name ShowInActionCenter -Force -ErrorAction Ignore
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore Remove-Item -Path Registry::HKEY_CLASSES_ROOT\WindowsCleanup -Recurse -Force -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -10957,14 +10983,19 @@ function SoftwareDistributionTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Persist the Settings notifications to prevent to immediately disappear from Action Center # Persist the Settings notifications to prevent to immediately disappear from Action Center
if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel")) if (-not (Test-Path -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel"))
@ -11021,7 +11052,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -11071,14 +11126,19 @@ function TempTask
{ {
"Register" "Register"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
$Items = @( Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
"$env:SystemRoot\System32\Tasks\SophiApp", # Remove folders in Task Scheduler. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
"$env:SystemRoot\System32\Tasks\Sophia Script", $ScheduleService = New-Object -ComObject Schedule.Service
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp", $ScheduleService.Connect()
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script" if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
) {
Remove-Item -Path $Items -Recurse -ErrorAction Ignore $ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
$TempTask = @" $TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
@ -11127,7 +11187,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
} }
"Delete" "Delete"
{ {
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\", "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore # Remove all old tasks
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification", SoftwareDistribution, Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there. We cannot remove all old folders explicitly and not get errors if any of folder do not exist
$ScheduleService = New-Object -ComObject Schedule.Service
$ScheduleService.Connect()
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script")
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia Script", $null)
}
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp")
{
$ScheduleService.GetFolder("\").DeleteFolder("SophiApp", $null)
}
# Removing current task
Unregister-ScheduledTask -TaskPath "\Sophia\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
# Remove folder in Task Scheduler if there is no tasks left there
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia")
{
if (($ScheduleService.GetFolder("Sophia").GetTasks(0) | Select-Object -Property Name).Name.Count -eq 0)
{
$ScheduleService.GetFolder("\").DeleteFolder("Sophia", $null)
}
}
} }
} }
} }
@ -12916,6 +13000,7 @@ function UpdateLGPEPolicies
} }
Write-Verbose -Message $Localization.Patient -Verbose Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue Write-Information -MessageData "" -InformationAction Continue
# Local Machine policies paths to scan recursively # Local Machine policies paths to scan recursively

15
src/Sophia_Script_for_Windows_11_PowerShell_7/Sophia.ps1

@ -2,8 +2,8 @@
.SYNOPSIS .SYNOPSIS
Default preset file for "Sophia Script for Windows 11 (PowerShell 7)" Default preset file for "Sophia Script for Windows 11 (PowerShell 7)"
Version: v6.2.0 Version: v6.2.1
Date: 22.10.2022 Date: 29.10.2022
Copyright (c) 20142022 farag Copyright (c) 20142022 farag
Copyright (c) 20192022 farag & Inestic Copyright (c) 20192022 farag & Inestic
@ -73,7 +73,7 @@ param
Clear-Host Clear-Host
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.0 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022" $Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 11 v6.2.1 (PowerShell 7) | Made with $([char]::ConvertFromUtf32(0x1F497)) of Windows | $([char]0x00A9) farag & Inestic, 2014$([char]0x2013)2022"
Remove-Module -Name Sophia -Force -ErrorAction Ignore Remove-Module -Name Sophia -Force -ErrorAction Ignore
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
@ -89,7 +89,6 @@ catch
Import-LocalizedData -BindingVariable Global:Localization -UICulture en-US -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia Import-LocalizedData -BindingVariable Global:Localization -UICulture en-US -BaseDirectory $PSScriptRoot\Localizations -FileName Sophia
} }
<# <#
.SYNOPSIS .SYNOPSIS
Run the script by specifying functions as an argument Run the script by specifying functions as an argument
@ -243,12 +242,12 @@ AppsSilentInstalling -Disable
# Включить автоматическую установку рекомендованных приложений (значение по умолчанию) # Включить автоматическую установку рекомендованных приложений (значение по умолчанию)
# AppsSilentInstalling -Enable # AppsSilentInstalling -Enable
# Disable suggestions on how I can set up my device # Do not suggest ways to get the most out of Windows and finish setting up this device
# Не показывать предложения по настройке устройства # Не предлагать способы завершения настройки этого устройства для наиболее эффективного использования Windows
WhatsNewInWindows -Disable WhatsNewInWindows -Disable
# Let Microsoft offer you tailored experiences based on the diagnostic data setting you have chosen (default value) # Suggest ways to get the most out of Windows and finish setting up this device
# Разрешите корпорации Майкософт использовать ваши диагностические данные для улучшения вашей работы со службами Майкрософт с помощью персонализированных советов, рекламы и рекомендаций (значение по умолчанию) # Предложить способы завершения настройки этого устройства для наиболее эффективного использования Windows
# WhatsNewInWindows -Enable # WhatsNewInWindows -Enable
# Don't let Microsoft use your diagnostic data for personalized tips, ads, and recommendations # Don't let Microsoft use your diagnostic data for personalized tips, ads, and recommendations

Loading…
Cancel
Save