1

クラスはで文書化されています

http://msdn.microsoft.com/en-us/library/aa375050%28VS.85%29.aspx

そして、このページから、それは抽象クラスではないようです:

http://msdn.microsoft.com/en-us/library/aa375084%28VS.85%29.aspx

しかし、以下のコードを実行するたびに、ManagementObjectSearcher.Get() で「無効なクラス」例外が発生します。それで、このクラスは存在しますか?

ManagementScope scope;
ConnectionOptions options = new ConnectionOptions();
options.Username = tbUsername.Text;
options.Password = tbPassword.Password;
options.Authority = String.Format("ntlmdomain:{0}", tbDomain.Text);
scope = new ManagementScope(String.Format("\\\\{0}\\root\\RSOP", tbHost.Text), options);
scope.Connect();
ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, new ObjectQuery("SELECT * FROM RSOP_RegistryPolicySetting"));
foreach (ManagementObject queryObj in searcher.Get())
{
    wmiResults.Text += String.Format("id={0}\n", queryObj["id"]);
    wmiResults.Text += String.Format("precedence={0}\n", queryObj["precedence"]);
    wmiResults.Text += String.Format("registryKey={0}\n", queryObj["registryKey"]);
    wmiResults.Text += String.Format("valueType={0}\n", queryObj["valueType"]);
}

上記の最初のリンクでは、「Rsopcls.mof」という「MOF」と呼ばれるものが要件としてリストされています。これは私が持っているべきですが、持っていないものですか?どうすれば入手できますか?クエリを実行するマシンまたはクエリを実行するマシンで必要ですか? または両方?

このファイルのコピーが 2 つあります。

C:\Windows>dir rsop*.mof /s
 Volume in drive C has no label.
 Volume Serial Number is 245C-A6EF

 Directory of C:\Windows\System32\wbem

02/11/2006  05:22           100.388 rsop.mof
               1 File(s)        100.388 bytes

 Directory of C:\Windows\winsxs\x86_microsoft-windows-grouppolicy-base-mof_31bf3856ad364e35_6.0.6001.18000_none_f2c4356a12313758

19/01/2008  07:03           100.388 rsop.mof
               1 File(s)        100.388 bytes

     Total Files Listed:
               2 File(s)        200.776 bytes
               0 Dir(s)   6.625.456.128 bytes free
4

1 に答える 1

0

当たり前。間違った名前空間を使用していました。root\RSOP\Computer でした。

于 2009-11-18T21:04:30.757 に答える