0

下面的代码应该尝试连接到我列表中的一台服务器。我的问题是会尝试所有这些组合锁定帐户吗?

uid = some1 pwd = 1thing

private void connect_all()
    {
        // Test
        string connstr;
        string[] idt =  {"-reu","-ram","-rar"};

        uid = textBox1.Text;
        pwd = textBox2.Text;
        ConnectionOptions options = new ConnectionOptions();
        options.Password = pwd;

        for (int i = 0; i < servers.Count; i++)
        {
            connstr = "\\\\" + servers[i].server + "\\root\\cimv2";
            for (int y = 0; y < idt.Length; y++)
            {
                options.Username = "-adm-" + uid + idt[y];
                try
                {
                    ManagementScope scope = new ManagementScope(connstr, options);
                    scope.Connect();
                    MessageBox.Show("Connect");
                }
                catch (Exception Ex)
                {
                    MessageBox.Show(Ex.Message);
                }
            }
        }

    }
4

1 回答 1

0

是的,与 MangementScope 连接将锁定一个帐户。

于 2014-02-26T14:34:04.200 回答