コード例 #1
0
        public bool IsUnjoinDomainSuccess()
        {
            TelnetClient  telnetClient = new TelnetClient(config.ClientIP, config.TelnetPort, config.ClientAdminUsername, config.ClientAdminPwd);
            string        response     = string.Empty;
            StringBuilder command      = new StringBuilder();

            command.Append(config.ClientScriptPath + config.IsUnjoinDomainSuccessScript + " ");
            telnetClient.WriteCommand(command.ToString());
            response = telnetClient.ReadResponse();
            return(telnetClient.CheckResponse(response));
        }
コード例 #2
0
        public bool UnjoinDomain()
        {
            //Samba does not support unjoin domain
            //or refer to nick's suggestion by deleting some ldb file on samba client
            TelnetClient  telnetClient = new TelnetClient(config.ClientIP, config.TelnetPort, config.ClientAdminUsername, config.ClientAdminPwd);
            string        response     = string.Empty;
            StringBuilder command      = new StringBuilder();

            command.Append(config.ClientScriptPath + config.UnjoinDomainScript);
            telnetClient.WriteCommand(command.ToString());
            response = telnetClient.ReadResponse();
            return(telnetClient.CheckResponse(response));
        }
コード例 #3
0
        public bool JoinDomainCreateAcctSAMR()
        {
            TelnetClient  telnetClient = new TelnetClient(config.ClientIP, config.TelnetPort, config.ClientAdminUsername, config.ClientAdminPwd);
            string        response     = string.Empty;
            StringBuilder command      = new StringBuilder();

            command.Append(config.ClientScriptPath + config.JoinDomainCreateAcctSAMRScript + " ");
            command.Append(config.FullDomainName + " ");
            command.Append(config.DomainAdminUsername + " ");
            command.Append(config.DomainAdminPwd);
            telnetClient.WriteCommand(command.ToString());
            response = telnetClient.ReadResponse();
            return(telnetClient.CheckResponse(response));
        }
コード例 #4
0
        public string LocateDomainController()
        {
            TelnetClient  telnetClient = new TelnetClient(config.ClientIP, config.TelnetPort, config.ClientAdminUsername, config.ClientAdminPwd);
            string        response     = string.Empty;
            StringBuilder command      = new StringBuilder();

            command.Append(config.ClientScriptPath + config.LocateDomainControllerScript + " ");
            command.Append(config.FullDomainName);
            telnetClient.WriteCommand(command.ToString());
            response = telnetClient.ReadResponse();
            string splitter = "\r\n";
            int    start    = response.IndexOf(splitter, StringComparison.OrdinalIgnoreCase) + splitter.Length;
            int    stop     = response.LastIndexOf(splitter, StringComparison.OrdinalIgnoreCase);

            if (start >= stop)
            {
                return(null);
            }
            else
            {
                string result = response.Substring(start, stop - start);
                return(result);
            }
        }