PowerShell / MMI

Other
24 stars 17 forks source link

CimSession.Create(null) does not work on Windows 7 (x86) #43

Open natnan opened 4 years ago

natnan commented 4 years ago

Perhaps this is expected. It's hard to find any information about that.

My goal is to get some WMI information out of Windows. System.Management is considered legacy apparently and does not work well with .NET Core when you don't have unspecified version of .NET Framework installed. And the recommended way is to utilize MMI.

It works fine on Windows 10 now but Windows 7 (x86 though not necessarily relevant) fails with not much to go on.

CimSession.Create(null);

Microsoft.Management.Infrastructure.CimException: FAILED
   at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, String errorMessage, InstanceHandle errorData)
   at Microsoft.Management.Infrastructure.CimException.ThrowIfMiResultFailure(MiResult result, InstanceHandle errorData)
   at Microsoft.Management.Infrastructure.CimSession.Create(String computerName, CimSessionOptions sessionOptions)
   at Microsoft.Management.Infrastructure.CimSession.Create(String computerName)

Tried both 1.0.0 and 2.0.0-preview2

shazha commented 4 years ago

You need Windows Management Framework 3.0 be installed on Windows 7 SP1. please install .Net Framework 4.0 first as it's required by WMF 3.0.

natnan commented 4 years ago

Right. That is not very ideal as the use case is just simple information gathering from the local system (productid, Windows version etc.) that should ideally be available without installing extra management frameworks. It's especially difficult when it's a desktop application requiring the information where adding such requirements is an overkill.

I understand the requirement from MMI perspective though, and it that's the way it is, feel free to close the issue.

Thanks.

valeriob commented 3 years ago

Hi, i'm having the same problem, even after i've installed the Windows Management Framework 3.0 on a windows 7 SP1 x64. The problem is that it's a windows 7 embedded , peraps there is some more requirement needed ? Thanks