Recipes by topic

Programs that run at startup

Win32_StartupCommand gathers the programs started at sign-in: Run registry keys and Startup folders, for the machine and for each user.

Get-CimInstance -ClassName Win32_StartupCommand |
    Select-Object -Property Name, Command, Location, User |
    Sort-Object -Property Location, Name

Location is the original place (registry key or folder) and User the account concerned. The class sees neither scheduled tasks nor automatic-start services: for the latter, see the recipe on stopped services.

Variant: remote

Comparing the results of several computers helps to spot an unexpected program.

$cimSession = New-CimSession -ComputerName 'PC01', 'PC02'
try {
    $cimParameters = @{
        CimSession = $cimSession
        ClassName  = 'Win32_StartupCommand'
    }
    Get-CimInstance @cimParameters |
        Select-Object -Property PSComputerName, Name, Command, User
} finally {
    Remove-CimSession -CimSession $cimSession
}

Classes used

← All recipes