Retrieve the list of stopped stervices using the Windows Management Interface (WMI)
By [)ia6l0 iii
Use the ManagementObjectSearcher to query the list of stopped services in Win32.
The code block below shows you how:
List<string> runningServices = new List<string>();
ManagementObjectSearcher moSearcher = new ManagementObjectSearcher(""SELECT
* FROM Win32_Service WHERE Started = False"");
foreach (ManagementObject service in moSearcher.Get())
runningServices.Add(service[""Caption""]);
Related FAQs
Use the ManagementObjectSearcher to query the Win32 services and retrieve the list of services.
Retrieve the list of stopped stervices using the Windows Management Interface (WMI) (513 Views)