Services from LocalHost
While trying to get a list of services from localhost...
An unhandled exception of type 'System.Management.ManagementException' occurred in system.management.dll
Additional information: Invalid namespace
I have the System.Management reference,
I have also imported the namespace.
The query is:
strQuery = "SELECT * FROM Win32_Service"
query = new ManagementObjectSearcher(ms, oq);
//This line generates the error
queryCollection = query.Get();
I don't see any errors in the information you provided. Maybe a look at this project
nvoigt, If your interested it was because of the scope I had written.
The proper way is:
ManagementScope scope = new ManagementScope("\\\\localhost\\root\\cimv2", options);
options is the connection options. Using the default constructor.
I'm not sure what '\\cimv2' is though
Is it possible to get a list of usernames logged in, Full user name and the IP their using ?
jsmith John Smith 192.168.43.66
sort of like a network inventory scanner....