NotImplementedException raised when using managed plugin

Hi all!

What I’m trying to do is get the UWF (Universal Write Filter) status in Unity. However, this requires the System.Management namespace, which Mono doesn’t implement. So I compiled a DLL with .NET 4.0, but any time I try to call it, it throws a NotImplementedException. What am I doing wrong?

Here’s the plugin’s full code:

using System;
using System.Management;

namespace UWFTools
{
    public class UWF
    {
        public static string GetUWFStatus()
        {
            ManagementScope scope = new ManagementScope(@"root\standardcimv2\embedded");
            ManagementClass UWFFilter = new ManagementClass(scope.Path.Path, "UWF_Filter", null);
            ManagementClass UWFOverlayConfig = new ManagementClass(scope.Path.Path, "UWF_OverlayConfig", null);
            ManagementClass UWFOverlay = new ManagementClass(scope.Path.Path, "UWF_Overlay", null);
            ManagementClass UWFServicing = new ManagementClass(scope.Path.Path, "UWF_Servicing", null);

            foreach (ManagementObject mo in UWFFilter.GetInstances())
            {
                if (mo.GetPropertyValue("CurrentEnabled").ToString() == "True")
                {
                    return "Enabled";
                }
                else
                {
                    return "Disabled";
                }
            }

            return "Unknown";
        }
    }
}

Bump

So I’m thinking the issue is that a DLL can’t use functionality unsupported by Mono either.

I will just pass the UWF status as a command line argument instead.