DeeStackOverflow
DeeStackOverflow

Reputation: 2781

How can I check if a windows service is installed using path of executable?

How can I check if a windows service is installed using just the executable path?
I checked the ServiceController class - it lets you use service name and display name but not the executable name to verify.

I only have the executable's FullName available for use in my code. Any ideas?

Upvotes: 1

Views: 1607

Answers (1)

Richard
Richard

Reputation: 109180

Two options.

  1. WMI. The Win32_Service class's PathName property has the executable command line (so includes parameters).

  2. Iterate through the registry

Upvotes: 2

Related Questions