【问题标题】:Windows Authentication With WMI使用 WMI 进行 Windows 身份验证
【发布时间】:2012-02-06 14:52:11
【问题描述】:

我想在使用 WMI 查询远程机器上的数据时使用 Windows 当前凭据,但在许多示例中我发现我必须使用 Connection 对象,它需要您提供用户名、密码和验证用户名和密码的权限如下图:

            Dim connection As New ConnectionOptions
            connection.Username = userNameBox.Text
            connection.Password = passwordBox.Text
            connection.Authority = "ntlmdomain:MyDomain"

            Dim scope As New ManagementScope( _
                "\\RemoteMachine\root\CIMV2", connection)
            scope.Connect()

我想绕过这些输入并改用当前的 Windows 登录凭据,有什么办法吗?

【问题讨论】:

    标签: windows wmi credentials


    【解决方案1】:

    这里是带有使用 Windows 凭据的连接选项的 C# 示例。

    ConnectionOptions connectionOptions = new ConnectionOptions
    {
        Authentication = AuthenticationLevel.PacketPrivacy,
        Impersonation = ImpersonationLevel.Impersonate
    };
    

    【讨论】:

      猜你喜欢
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-27
      • 1970-01-01
      • 2010-11-27
      • 2016-03-24
      相关资源
      最近更新 更多