The Wmi task is part of the MSBuild Extension Pack. On one of our development machines, it thrown ManagementException not found. Here's the target:
<Target Name="Clean">
<ItemGroup>
<WmiProps Include="State"/>
<WmiProps Include="DisplayName"/>
</ItemGroup>
<!-- Create list of VIKAD services that are currently running. -->
<Wmi TaskAction="Query" Class="Win32_Service WHERE DisplayName LIKE '%ServiceName%'" Properties="@(WmiProps)" Namespace="\root\CIMV2" MachineName="$(LocalDbServer)">
<Output TaskParameter="Info" ItemName="Info"/>
</Wmi>
<Wmi TaskAction="Execute" Class="Win32_Service" Method="StopService" Instance="Name='%(Info.DisplayName)'" Namespace="\root\CIMV2">
<Output TaskParameter="ReturnValue" PropertyName="Rval1"/>
</Wmi>
</Target>
The second WMI task is the one that throws the exception.