@ -11966,9 +11966,9 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
{
{
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
}
}
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Value $ToastNotification -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Value $ToastNotification -Encoding Default -Force
# Replace here-string double quotes with single ones
# Replace here-string double quotes with single ones
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Encoding utf8 ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Encoding utf8 -Force
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Encoding Default ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Encoding Default -Force
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
$ToastNotification = @ "
$ToastNotification = @ "
@ -11977,7 +11977,7 @@ while ([WinAPI.Focus]::GetFocusAssistState() -ne "OFF")
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " , 0
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " , 0
" @
" @
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs " -Value $ToastNotification -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs " -Value $ToastNotification -Encoding Default -Force
# Create the "Windows Cleanup Notification" task
# Create the "Windows Cleanup Notification" task
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs "
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs "
@ -11999,6 +11999,9 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
}
}
" Delete "
" Delete "
{
{
# Remove files first unless we cannot remove folder if there's no more tasks there
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Force -ErrorAction Ignore
# Remove all old tasks
# Remove all old tasks
# We have to use -ErrorAction Ignore in both cases, unless we get an error
# We have to use -ErrorAction Ignore in both cases, unless we get an error
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
@ -12033,8 +12036,6 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
}
}
}
}
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\Windows_Cleanup_Notification.ps1 " -Force -ErrorAction Ignore
}
}
}
}
}
}
@ -12258,9 +12259,9 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
{
{
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
}
}
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Value $SoftwareDistributionTask -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Value $SoftwareDistributionTask -Encoding Default -Force
# Replace here-string double quotes with single ones
# Replace here-string double quotes with single ones
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Encoding utf8 ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Encoding utf8 -Force
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Encoding Default ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Encoding Default -Force
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
$SoftwareDistributionTask = @ "
$SoftwareDistributionTask = @ "
@ -12269,7 +12270,7 @@ Get-ChildItem -Path `$env:SystemRoot\SoftwareDistribution\Download -Recurse -For
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " , 0
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " , 0
" @
" @
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs " -Value $SoftwareDistributionTask -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs " -Value $SoftwareDistributionTask -Encoding Default -Force
# Create the "SoftwareDistribution" task
# Create the "SoftwareDistribution" task
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs "
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs "
@ -12291,6 +12292,9 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
}
}
" Delete "
" Delete "
{
{
# Remove files first unless we cannot remove folder if there's no more tasks there
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Force -ErrorAction Ignore
# Remove all old tasks
# Remove all old tasks
# We have to use -ErrorAction Ignore in both cases, unless we get an error
# We have to use -ErrorAction Ignore in both cases, unless we get an error
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
@ -12320,8 +12324,6 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
}
}
}
}
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\SoftwareDistributionTask.ps1 " -Force -ErrorAction Ignore
}
}
}
}
}
}
@ -12543,9 +12545,9 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
{
{
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
New-Item -Path $env:SystemRoot \ System32 \ Tasks \ Sophia -Force
}
}
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Value $TempTask -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Value $TempTask -Encoding Default -Force
# Replace here-string double quotes with single ones
# Replace here-string double quotes with single ones
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Encoding utf8 ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Encoding utf8 -Force
( Get-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Encoding Default ) . Replace ( '@""' , '@"' ) . Replace ( '""@' , '"@' ) | Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Encoding Default -Force
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
# Create vbs script that will help us calling PS1 script silently, without interrupting system from Focus Assist mode turned on, when a powershell.exe console pops up
$TempTask = @ "
$TempTask = @ "
@ -12554,7 +12556,7 @@ Get-ChildItem -Path `$env:TEMP -Recurse -Force | Where-Object -FilterScript {`$_
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\TempTask.ps1 " , 0
CreateObject ( " Wscript.Shell " ) . Run " powershell.exe -ExecutionPolicy Bypass -NoProfile -NoLogo -WindowStyle Hidden -File %SystemRoot%\System32\Tasks\Sophia\TempTask.ps1 " , 0
" @
" @
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs " -Value $TempTask -Encoding utf8 -Force
Set-Content -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs " -Value $TempTask -Encoding Default -Force
# Create the "Temp" task
# Create the "Temp" task
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs "
$Action = New-ScheduledTaskAction -Execute wscript . exe -Argument " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs "
@ -12576,6 +12578,9 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
}
}
" Delete "
" Delete "
{
{
# Remove files first unless we cannot remove folder if there's no more tasks there
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Force -ErrorAction Ignore
# Remove all old tasks
# Remove all old tasks
# We have to use -ErrorAction Ignore in both cases, unless we get an error
# We have to use -ErrorAction Ignore in both cases, unless we get an error
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
Get-ScheduledTask -TaskPath " \Sophia Script\ " , " \SophiApp\ " -ErrorAction Ignore | ForEach-Object -Process {
@ -12605,8 +12610,6 @@ CreateObject("Wscript.Shell").Run "powershell.exe -ExecutionPolicy Bypass -NoPro
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
$ScheduleService . GetFolder ( " \ " ) . DeleteFolder ( " Sophia " , $null )
}
}
}
}
Remove-Item -Path " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.vbs " , " $ env:SystemRoot\System32\Tasks\Sophia\TempTask.ps1 " -Force -ErrorAction Ignore
}
}
}
}
}
}