I am looking for an API that lists all the startup applications in Windows, and can return whether each application is enabled or disabled at startup and it's level of impact.
These settings and the startup apps referred to are found in Settings->Apps->Startup.
I have found PowerShell and command line commands to list some (but not all) of the start up apps. However I am looking for a way to do so programmatically in C# so I do not need to execute a script to list the startup apps. The commands also are limited to the name, command, and location. They do not show whether the startup app is enabled/disabled and the level of impact.
These are the commands I have used to list some of the start up apps. Powershell: Get-CimInstance Win32_StartupCommand | Select-Object Name, command, Location, User | Format-List
Command Line: wmic startup get caption,command
CodePudding user response:
There is no API for listing startup programs. You could use some of options:
- Scan Registry for startup command line.
- Leverage Autoruns, as I know it has option to export report.
CodePudding user response:
You could run the powershell:
using(PowerShell ps = PowerShell.Create())
{
ps.AddCommand("the command")
.AddParameter("parname","value");
ps.Invoke();
Collection<PSObject> result = ps.Invoke();
foreach(var outputObject in result)
{
// outputObject contains the result of the powershell script
}
}