Browse Source

Fixed TempTask function

master
Dmitry Nefedov 1 year ago
parent
commit
75db24fb17
  1. 11
      src/Sophia_Script_for_Windows_10/Module/Sophia.psm1
  2. 11
      src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1
  3. 11
      src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1
  4. 11
      src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1
  5. 9
      src/Sophia_Script_for_Windows_11/Module/Sophia.psm1
  6. 9
      src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

11
src/Sophia_Script_for_Windows_10/Module/Sophia.psm1

@ -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

11
src/Sophia_Script_for_Windows_10_LTSC_2019/Module/Sophia.psm1

@ -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

11
src/Sophia_Script_for_Windows_10_LTSC_2021/Module/Sophia.psm1

@ -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

11
src/Sophia_Script_for_Windows_10_PowerShell_7/Module/Sophia.psm1

@ -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

9
src/Sophia_Script_for_Windows_11/Module/Sophia.psm1

@ -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
# Unnecessary folders to remove
`$Paths = @(
# 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
(-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

9
src/Sophia_Script_for_Windows_11_PowerShell_7/Module/Sophia.psm1

@ -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
# Unnecessary folders to remove
`$Paths = @(
# 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
(-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

Loading…
Cancel
Save