Skip to content

Commit

Permalink
Fixed TempTask function
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Oct 29, 2023
1 parent 96fe67d commit 75db24f
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 12 deletions.
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13570,8 +13570,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
# This the only way to get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10164,8 +10164,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
# This the only way to get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11280,8 +11280,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force
# This the only way to get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13594,8 +13594,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force

# This the only way to get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13012,8 +13012,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force

# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down
11 changes: 9 additions & 2 deletions src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13033,8 +13033,15 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
# Run the task
Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_.CreationTime -lt (Get-Date).AddDays(-1)} | Remove-Item -Recurse -Force

# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
Remove-Item -Path (-join ("`$env:SystemDrive\", '$WinREAgent')) -Recurse -Force
# Unnecessary folders to remove
`$Paths = @(
# Get "C:\$WinREAgent" path because we need to open brackets for $env:SystemDrive but not for $WinREAgent
(-join ("`$env:SystemDrive\", '`$WinREAgent')),
(Get-Item -Path `$env:SystemDrive\Recovery -Force | Where-Object -FilterScript {`$_.Attributes -match "Hidden"}).FullName,
"`$env:SystemDrive\Intel",
"`$env:SystemDrive\PerfLogs"
)
Remove-Item -Path `$Paths -Recurse -Force

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
Expand Down

0 comments on commit 75db24f

Please sign in to comment.