15

I need to get information about system such as: motherboard info, hdd info, e.t.c. in OS Windows. I can get it from wmi service. But I need to gather it with .NET core application.

I know in .NET application there interface IWbemServices to interact with WMI service, but I can't find something similar in .NET core.

So I have a questions:

  • Can I create COM object with .NET core application. If it's "yes" then how can I do it?
  • Are there other ways to get information about hardware, through .NET core?
theroom101
  • 599
  • 1
  • 9
  • 23
  • Why do you want to interact with COM and WMI from a .NET Core application? .NET Core is cross-platform, but COM/WMI are Windows-specific. Maybe it would make sense to build a .NET Framework project instead? – Nate Barbettini Dec 28 '16 at 00:19
  • as I said, I need some hardware information, such as Motherboard, cpu or RAM information. And it should be .net core app. – theroom101 Dec 28 '16 at 11:09
  • A .NET Core app that only runs on Windows? – Nate Barbettini Dec 28 '16 at 17:57
  • for Linux there is other solution. – theroom101 Dec 29 '16 at 05:17
  • @Nate Barbettini net core compiled for net461 is very common eg use Asp.Net Core ( and its modern libs) but have a win32 dependency - Service fabric , Event Store etc etc – user1496062 Aug 30 '17 at 00:24
  • @NateBarbettini .Net Core has quite a few performance enhancements over the more robust .Net Framework. An ASP.Net Core application can run with much better performance. Not to mention some of the language goodies. – Stuart Jun 12 '18 at 11:02
  • did you try Nuget package https://www.nuget.org/packages/System.Management/ ? – Kiquenet Dec 03 '20 at 12:35
  • WMI in Linux ? COM/WMI are Windows-specific.It is only for Windows, NetCore 3.1 with WMI (Management) doesnt' work in Linux. – Kiquenet Dec 03 '20 at 12:37

1 Answers1

5

The query is now available in Windows Compatibility Pack under System.Management.

Mohan Kumar
  • 621
  • 1
  • 8
  • 25
  • Unfortunately this does not actually work with SCD in Dot Net Core. System.Management is dependent on COM interop which there is no near future solution to. https://github.com/dotnet/corert/issues/6728 – Dane Balia Mar 05 '19 at 13:10
  • What's about https://www.nuget.org/packages/System.Management/. ? – Kiquenet Dec 03 '20 at 12:35
  • I'm getting an "EventLog access is not supported on this platform" error when I add the Windows Compatibility pack to my .Net Core app. – user3167162 Dec 06 '22 at 00:51