java wmi_WMI依赖服务使用WMI查询
我正在使用WMI查詢來獲取共享文件夾:
public static List GetNetworkShareFoldersList(string serverName)
{
List shares = new List();
// do not use ConnectionOptions to get shares from local machine
ConnectionOptions connectionOptions = new ConnectionOptions();
//connectionOptions.Username = @"Domain\Administrator";
//connectionOptions.Password = "password";
//connectionOptions.Impersonation = ImpersonationLevel.Impersonate;
ManagementScope scope = new ManagementScope("\\\\" + serverName + "\\root\\CIMV2",
connectionOptions);
scope.Connect();
ManagementObjectSearcher worker = new ManagementObjectSearcher(scope,
new ObjectQuery("select Name from win32_share"));
foreach (ManagementObject share in worker.Get())
{
shares.Add(share["Name"].ToString());
}
return shares;
}
現(xiàn)在我的問題是這個(gè)wmi代碼依賴于本地或遠(yuǎn)程機(jī)器上的任何Windows服務(wù)嗎?... bcoz我從上面的代碼得到0結(jié)果
總結(jié)
以上是生活随笔為你收集整理的java wmi_WMI依赖服务使用WMI查询的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java web 的开发环境_JAVA
- 下一篇: IntelXeon E5-2620相当于