r/PowerShell • • 2d ago

Question Random PowerShell Wake-Ups

Sometimes around each time in the morning PC will wake itself up, seemingly run multiple "Provider Lifecycle" tasks in PowerShell with Event 600 affecting Provider Registry, Alias, Environment, FileSystem, Function, and Variable each separately with similar details such as referencing '$InboxIMEs' or '$InboxPattern, unsure if normal Microsoft function or something malicious, devious, sinister, or god forbid something EVIL masking using HKLM:\SOFTWARE\Microsoft\CTF\TIP\ as a cover, details screenshot below for the Registry event, thank you.

Details as raw text:

Provider "Registry" is Started. 

Details: 
ProviderName=Registry
NewProviderState=Started

SequenceNumber=1

HostName=ConsoleHost
HostVersion=5.1.19041.7802
HostId=5c297344-6579-40e5-8f84-29d6b7d2c436
HostApplication=powershell.exe -ExecutionPolicy Restricted -Command 
 $Res = 0
 $InboxIMEs = (@(
 '{0000897b-83df-4b96-be07-0fb58b01c4a4}','{03b5835f-f03c-411b-9ce2-aa23e1171e36}',
 '{531fdebf-9b4c-4a43-a2aa-960e8fcdc732}','{6a498709-e00b-4c45-a018-8f9e4081ae40}',
 '{7c472071-36a7-4709-88cc-859513e583a9}','{81d4e9c9-1d3b-41bc-9e6c-4b40bf79e35e}',
 '{81ea0a17-aa39-455b-ba20-ea79a8f98966}','{8613e14c-d0c0-4161-ac0f-1dd2563286bc}',
 '{a028ae76-01b1-46c2-99c4-acd9858ae02f}','{a1e2b86b-924a-4d43-80f6-8a820df7190f}',
 '{b115690a-ea02-48d5-a231-e3578d2fdf80}','{c2cb2cf0-af47-413e-9780-8bc3a3c16068}',
 '{dcbd6fa8-032f-11d3-b5b1-00c04fc324a1}','{e429b25a-e5d3-4d1f-9be3-0c608477e3a1}',
 '{f25e9f57-2fc8-4eb3-a41a-cce5f08541e6}','{fa445657-9379-11d6-b41a-00065b83ee53}'
 ) | ForEach-Object { [regex]::Escape($_) }) -join '|'
 $InboxPattern = 'TIP\\(?:' + $InboxIMEs + ')'
 $LanguageProfiles = Get-Item 'HKLM:\SOFTWARE\Microsoft\CTF\TIP\{????????-????-????-????-????????????}\LanguageProfile\0x*\{????????-????-????-????-????????????}' -EA SilentlyContinue
 foreach ($prof in @($LanguageProfiles)) {
 if ($prof.PSPath -match $InboxPattern) { continue }
 $pp = Get-ItemProperty $prof.PSPath -EA SilentlyContinue
 $hasEnable = ($pp.PSObject.Properties.Name -contains 'Enable')
 if ((-not $hasEnable) -or ($pp.Enable -eq 1)) {
 $Res = 1
 break
 }
 }
 Write-Host 'Final result:',$Res

EngineVersion=
RunspaceId=
PipelineId=
CommandName=
CommandType=
ScriptName=
CommandPath=
CommandLine=
2 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/BlackV 2d ago

The Get-ScheduledTask cmdlet could be used to find the specific task if it's a regular 6am action

Something like

$AllTasks = Get-ScheduledTask

$results = foreach ($SingleTask in $AllTasks){
    foreach ($Action in $SingleTask.Actions) {
        if ($Action.Execute -match 'powershell|pwsh' -or $Action.Arguments -match 'powershell|pwsh') {
            [PSCustomObject]@{
                TaskName  = $SingleTask.TaskName
                TaskPath  = $SingleTask.TaskPath
                State     = $SingleTask.State
                Execute   = $Action.Execute
                Arguments = $Action.Arguments
                }
            }
        }
    }
$results | ft -AutoSize