Not able to use ManagementObjectSearcher under Windows Service (Topshelf)

0

I have simple Windows Service (Topshelf) written in .NET. When I try to use ManagementObjectSearcher (specifically to search connected disk drives) I get error:

The specified service does not exist as an installed service. (Exception from HRESULT: 0x80070424)

var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");


 searcher.Get())

Everything else works fine (eg. using repository to access DB), only fails on this.

c#
.net
windows-services
topshelf
asked on Stack Overflow Jul 27, 2017 by contrashadow • edited Jul 27, 2017 by contrashadow

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0