Missing directive or assembly reference using WMI ManagementObjectSearcher? Missing directive or assembly reference using WMI ManagementObjectSearcher? windows windows

Missing directive or assembly reference using WMI ManagementObjectSearcher?


You are missing a reference to the assembly containing the type ManagementObjectSearcher, which is in the System.Managementnamespace. Add this namespace and it should work.

You will have to rightclick the project -> add reference and add the System.Management assembly. System.Managment is not added automatically with the creation of a new project.

WMI reference
WMI + C#