c# - 断开管理范围

标签 c# wmi

我正在使用 WMI 的 ManagementScope。有一个 connect() 方法,但没有断开连接的方法。我如何断开与 ManagementScope 的连接?
我尝试使用“使用”选项,但它不是 IDisposable,即使我超出了范围,netstat 仍然显示我已连接。

最佳答案

看起来您应该更改作用域的任何属性,它将断开连接:

"A scope is disconnected after creation until someone explicitly calls Connect (), or uses the scope for any operation that requires a live connection. Also, the scope is disconnected from the previous connection whenever the identifying properties of the scope are changed."

正如我在这里发现的:

System.Management - How to disconnect from remote computer?

关于c# - 断开管理范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7011999/

相关文章:

c# - 用于赌场类型游戏的 Azure 体系结构

c# - GetChildAtPoint 方法返回错误的控件

c# - 自旋锁,它们有多大用处?

javascript - ASP.NET 在按键时从客户端调用服务器端方法

c# - 如果我不知道它的类型,如何从远程机器获取注册表值? (C#)

c# - 临时存储文件

c# - 使用 ManagementObject 重启远程服务

c# - 如何使用 C# 在 DNS 中创建 SRV 记录

c# - .NET 中 Windows 服务的进程内 WMI 提供程序

c# - 如何确定网络路径是否可用(在线或离线)?