Skip to content

Commit

Permalink
29.10.2022 6.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 28, 2022
1 parent 0835b38 commit b413c5e
Show file tree
Hide file tree
Showing 25 changed files with 762 additions and 249 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Sophia Script for Windows is the largest PowerShell module on `GitHub` for `Wind

## 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)

Expand Down Expand Up @@ -136,7 +136,7 @@ Sophia Script for Windows is the largest PowerShell module on `GitHub` for `Wind
* Set up UI & Personalization;
* Uninstall OneDrive "correctly";
* 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 location of the user folders programmatically (without moving user files) within interactive menu using arrows to select a drive
* "Desktop";
Expand Down Expand Up @@ -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)

```powershell
Sophia -Functions <tab>
Sophia -Functions temp<tab>
Sophia -Functions unin<tab>
Sophia -Functions uwp<tab>
Sophia -Functions<kbd>TAB</kbd>
Sophia -Functions temp<kbd>TAB</kbd>
Sophia -Functions unin<kbd>TAB</kbd>
Sophia -Functions uwp<kbd>TAB</kbd>
Sophia -Functions "DiagTrackService -Disable", "DiagnosticDataLevel -Minimal", UninstallUWPApps
UninstallUWPApps, "PinToStart -UnpinAll"
Expand Down
6 changes: 3 additions & 3 deletions src/Sophia_Script_for_Windows_10/Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.14.0
Date: 22.10.2022
Version: v5.14.1
Date: 29.10.2022
Copyright (c) 2014—2022 farag
Copyright (c) 2019—2022 farag & Inestic
Expand Down Expand Up @@ -54,7 +54,7 @@ function Sophia

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
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
Expand Down
2 changes: 1 addition & 1 deletion src/Sophia_Script_for_Windows_10/Manifest/Sophia.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.14.0'
ModuleVersion = '5.14.1'
GUID = '109cc881-c42b-45af-a74a-550781989d6a'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'
Expand Down
150 changes: 118 additions & 32 deletions src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.SYNOPSIS
Sophia Script is a PowerShell module for Windows 10 & Windows 11 fine-tuning and automating the routine tasks
Version: v5.14.0
Date: 22.10.2022
Version: v5.14.1
Date: 29.10.2022
Copyright (c) 2014—2022 farag
Copyright (c) 2019—2022 farag & Inestic
Expand Down Expand Up @@ -11279,14 +11279,19 @@ function CleanupTask
{
"Register"
{
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName "Windows Cleanup", "Windows Cleanup Notification" -Confirm:$false -ErrorAction Ignore
$Items = @(
"$env:SystemRoot\System32\Tasks\SophiApp",
"$env:SystemRoot\System32\Tasks\Sophia Script",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script"
)
Remove-Item -Path $Items -Recurse -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 folders in Task Scheduler. 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)
}

Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches | ForEach-Object -Process {
Remove-ItemProperty -Path $_.PsPath -Name StateFlags1337 -Force -ErrorAction Ignore
Expand Down Expand Up @@ -11477,15 +11482,37 @@ while (`$true)
}
"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 {
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

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 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)
}
}
}
}
}
Expand Down Expand Up @@ -11535,14 +11562,19 @@ function SoftwareDistributionTask
{
"Register"
{
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName SoftwareDistribution -Confirm:$false -ErrorAction Ignore
$Items = @(
"$env:SystemRoot\System32\Tasks\SophiApp",
"$env:SystemRoot\System32\Tasks\Sophia Script",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script"
)
Remove-Item -Path $Items -Recurse -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 folders in Task Scheduler. 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)
}

# 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"))
Expand Down Expand Up @@ -11599,7 +11631,31 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
}
"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)
}
}
}
}
}
Expand Down Expand Up @@ -11649,14 +11705,19 @@ function TempTask
{
"Register"
{
Unregister-ScheduledTask -TaskPath "\Sophia Script\", "\SophiApp\" -TaskName Temp -Confirm:$false -ErrorAction Ignore
$Items = @(
"$env:SystemRoot\System32\Tasks\SophiApp",
"$env:SystemRoot\System32\Tasks\Sophia Script",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\SophiApp",
"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Sophia Script"
)
Remove-Item -Path $Items -Recurse -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 folders in Task Scheduler. 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)
}

$TempTask = @"
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
Expand Down Expand Up @@ -11705,7 +11766,31 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
}
"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)
}
}
}
}
}
Expand Down Expand Up @@ -13499,6 +13584,7 @@ function UpdateLGPEPolicies
}

Write-Verbose -Message $Localization.Patient -Verbose
Write-Verbose -Message $Localization.GPOUpdate -Verbose
Write-Information -MessageData "" -InformationAction Continue

# Local Machine policies paths to scan recursively
Expand Down
6 changes: 3 additions & 3 deletions src/Sophia_Script_for_Windows_10/Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.SYNOPSIS
Default preset file for "Sophia Script for Windows 10"
Version: v5.14.0
Date: 22.10.2022
Version: v5.14.1
Date: 29.10.2022
Copyright (c) 2014—2022 farag
Copyright (c) 2019—2022 farag & Inestic
Expand Down Expand Up @@ -74,7 +74,7 @@ param

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
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
Expand Down
6 changes: 3 additions & 3 deletions src/Sophia_Script_for_Windows_10_LTSC_2019/Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.SYNOPSIS
The TAB completion for functions and their arguments
Version: v5.4.0
Date: 22.10.2022
Version: v5.4.1
Date: 29.10.2022
Copyright (c) 2014—2022 farag
Copyright (c) 2019—2022 farag & Inestic
Expand Down Expand Up @@ -54,7 +54,7 @@ function Sophia

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
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = '..\Module\Sophia.psm1'
ModuleVersion = '5.4.0'
ModuleVersion = '5.4.1'
GUID = 'a36a65ca-70f9-43df-856c-3048fc5e7f01'
Author = 'Dmitry "farag" Nefedov'
Copyright = '(c) 2014—2022 farag & Inestic. All rights reserved'
Expand Down
Loading

0 comments on commit b413c5e

Please sign in to comment.