How can I use ServiceController to tell me if a service has been registered or not? In the code fragment below, the check for a null DisplayName results in a System.InvalidOperationException.
Is there a straightforward way of doing this that I'm completely missing?
ServiceController sc = new ServiceController("TestService");
if (sc.DisplayName == null)
{
// unregistered or missing service
}