0

I need to access to a WMI class called "Win32_LogicalDiskToPartition". I can access to this class in many windows (XP/7/8/8.1), but I found a particular Windows 8.1 where this class is not accessed.

To test this I use Powershell, this commnad returns "invalid class" in the windows 8.1 with the problem.

Get-WmiObject Win32_LogicalDiskToPartition

I need to access to this class in a c# application. The code used to access to this class is:

ManagementObjectSearcher searcher1 = new ManagementObjectSearcher("SELECT *     FROM Win32_LogicalDiskToPartition");
foreach (ManagementObject dm in searcher1.Get())
{
}

The point is that I check the consistency of the repository with this:

C:\Windows\system32>winmgmt /verifyrepository

The return message is this in the laptop problem:

WMI repository is consistent
dlopezgonzalez
  • 4,217
  • 5
  • 31
  • 42
  • 1
    While I don't know why you aren't getting the WMI class, the solution [on this question](http://stackoverflow.com/questions/2155215/get-corresponding-physical-disk-drives-of-mountpoints-with-wmi-queries) might be helpful to you. You might also try WMI Explorer ([old native one](https://www.ks-soft.net/hostmon.eng/wmi/), [new .NET one](https://wmie.codeplex.com/)) to see if it appears there. – Polynomial Jul 01 '15 at 10:24
  • Try [rebuilding the WMI repository](http://blogs.technet.com/b/askperf/archive/2009/04/13/wmi-rebuilding-the-wmi-repository.aspx) on that machine. – Ansgar Wiechers Jul 01 '15 at 11:22
  • What do you get when you run `wmic path Win32_LogicalDiskToPartition`? – Bacon Bits Jul 01 '15 at 12:00
  • I get "Invalid class" message. – dlopezgonzalez Jul 01 '15 at 12:42

0 Answers0