ServiceController Class - How Can I utilize this...

Hey gang,

I would like to utilize the ServiceController Class in Windows:

ServiceController

Obviously, I’d need to use declares. I’m not very good with Windows declares so was wondering if someone could help point me in the right direction or perhaps someone is already using this.

I reached out to Christian but it doesn’t look like MBS has this at this time…

Thanks,

Jon

.Net might not expose that in a way you can directly

What is it you think you want the service controller for as Win32 has a set of service API’s that might do what you need

Ah. I didn’t see you needed .NET for that. Forget it then…

What I want to do is see if the WMI service is running and if not restart it. I have some requirements in my app for WMI to be running and I saw a situation with a customer today where WMI had crashed and was causing problems. Once I restarted it, things were fine.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms685942(v=vs.85).aspx

possibly QueryServiceStatus and StartService