Zerobinary99
Zerobinary99

Reputation: 552

How to get a list of all services on Windows 7?

Is there a way to get a complete list of all services in Win 7 without having to install APIs such as Net Framework 4? I want to get the list as natively as possible.

Upvotes: 2

Views: 11082

Answers (4)

Dave
Dave

Reputation: 1

I don't know if this will help you but you can see a list of running services by going into the cmd line and inputting net start

That will give you a nice list of what is running.

Upvotes: 0

Amith George
Amith George

Reputation: 5916

Download the tool Wmi Code Creator. It will help you craft your WMI queries in C#, VB.Net or Visual Basic Script.

Here is a solution using VBScript

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
Set colItems = objWMIService.ExecQuery( _
    "SELECT * FROM Win32_Service",,48) 
For Each objItem in colItems 
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "Win32_Service instance"
    Wscript.Echo "-----------------------------------"
    Wscript.Echo "DisplayName: " & objItem.DisplayName
Next

What is WMI? (From http://technet.microsoft.com/en-us/library/ee692772.aspx)

Windows Management Instrumentation is a core Windows management technology; you can use WMI to manage both local and remote computers. WMI provides a consistent approach to carrying out day-to-day management tasks with programming or scripting languages. For example, you can:

* Start a process on a remote computer.
* Schedule a process to run at specific times on specific days.
* Reboot a computer remotely.
* Get a list of applications installed on a local or remote computer.
* Query the Windows event logs on a local or remote computer.

The word “Instrumentation” in WMI refers to the fact that WMI can get information about the internal state of computer systems, much like the dashboard instruments of cars can retrieve and display information about the state of the engine. WMI “instruments” by modeling objects such as disks, processes, or other objects found in Windows systems. These computer system objects are modeled using classes such as Win32_LogicalDisk or Win32_Process; as you might expect, the Win32_LogicalDisk class models the logical disks installed on a computer, and the Win32_Process class models any processes currently running on a computer. Classes are based on the extensible schema called the Common Information Model (CIM). The CIM schema is a public standard of the Distributed Management Task Force (http://www.dmtf.org).

WMI capabilities also include eventing, remoting, querying, views, user extensions to the schema, instrumentation, and more. http://technet.microsoft.com/en-us/library/ee692772.aspx

Upvotes: 1

Antonio Bakula
Antonio Bakula

Reputation: 20693

You can use Win API OpenSCManager function and then enumerate services and theirs statuses with EnumServicesStatus

There is a complete reference for Services API on Dev Center

Upvotes: 3

MichaelN
MichaelN

Reputation: 1744

run the cmd console as admnistrator and then run "sc query type= service state= all"

Upvotes: 5

Related Questions