How do you generate C# classes for accessing WMI?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
To generate strongly typed WMI classes, use the Management Strongly typed class generator (MgmtClassGen.exe). It's usually in C:\Program Files\Microsoft Visual Studio X\SDK\vX\Bin. The parameters are at MSDN and they even have a page describing the code generated. If you have to do a lot of work with WMI, it's a lifesaver.
Easier approach (Visual Studio users):
Add WMI classes to VisualStudio's Server Explorer. E.g.
Get Visual Studio to call MgmtClassGen.exe for you. E.g.
@VanOrman provides additional references for MgmtClassGen.exe.
You can try WMICodeCreator it generates vbscript jscript vb.net and c# code Download WMICodeCreator from Microsoft