创buildwin32_trustee对象的问题

我尝试像这样创build它:

new-object system.management.managementclass win32_trustee

我得到这个错误:

new-object : The following exception occurred while retrieving the type name hierarchy: "Not found ". At line:1 char:1 + new-object system.management.managementclass win32_trustee + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-Object], ExtendedTypeSystemException + FullyQualifiedErrorId : CatchFromBaseGetTypeNameHierarchy,Microsoft.PowerShell.Commands.NewObjectCommand

你应该得到一个TypeName对象: System.Management.ManagementClass#ROOT\cimv2\Win32_Trustee

但是,我得到一个错误。 似乎我已经丢失或删除了win32_trustee类,但不记得如何。 我只是想把它弄回来。 您可以检查在此链接build议的其他事情: https : //stackoverflow.com/questions/41050688/the-follow-exception-occurred-while-retrieving-the-type-name-hierarchy-not#

任何帮助不胜感激。

您可以尝试重新编译MOF文件。 Win32_Trustee是位于%SystemRoot%\ System32 \ wbem \中的secrcw32.mof的一部分。

打开提升的命令提示符并运行以下命令:

mofcomp.exe %SystemRoot%\System32\wbem\secrcw32.mof

有关重新编译WMI MOF的更多信息, 请查询性能团队博客