Ejemplo n.º 1
0
 private void FireComputerFound(ActiveDirectoryComputer computer)
 {
     if (this.ComputerFound != null)
     {
         this.ComputerFound(computer);
     }
 }
        public static ActiveDirectoryComputer FromDirectoryEntry(String domain, DirectoryEntry computer)
        {
            ActiveDirectoryComputer comp = new ActiveDirectoryComputer { Tags = domain };

            if (computer.Properties != null)
            {
                comp.NameFromEntry(computer);
                comp.OperationSystemFromEntry(computer);
                comp.DistinquishedNameFromEntry(computer);
            }

            return comp;
        }
Ejemplo n.º 3
0
 private void OnClientComputerFound(ActiveDirectoryComputer computer)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new ComputerFoundDelegate(this.OnClientComputerFound), new object[] {computer});
     }
     else
     {
         this.bsComputers.Add(computer);
         this.lblProgressStatus.Text =
             String.Format("Scaning... {0} computers found.",
                           this.bsComputers.Count);
         this.gridComputers.Refresh();
     }
 }
Ejemplo n.º 4
0
 private void OnClientComputerFound(ActiveDirectoryComputer computer)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new ComputerFoundDelegate(this.OnClientComputerFound), new object[] { computer });
     }
     else
     {
         this.bsComputers.Add(computer);
         this.lblProgressStatus.Text =
             String.Format("Scaning... {0} computers found.",
                           this.bsComputers.Count);
         this.gridComputers.Refresh();
     }
 }
        public static ActiveDirectoryComputer FromDirectoryEntry(String domain, DirectoryEntry computer)
        {
            ActiveDirectoryComputer comp = new ActiveDirectoryComputer {
                Tags = domain
            };

            if (computer.Properties != null)
            {
                comp.NameFromEntry(computer);
                comp.OperationSystemFromEntry(computer);
                comp.DistinquishedNameFromEntry(computer);
            }

            return(comp);
        }
Ejemplo n.º 6
0
 private void SearchComputers(string domain)
 {
     using (DirectoryEntry entry = new DirectoryEntry(string.Format("LDAP://{0}", domain)))
     {
         using (DirectorySearcher mySearcher = new DirectorySearcher(entry))
         {
             mySearcher.Asynchronous = true;
             mySearcher.Filter       = ("(objectClass=computer)");
             foreach (SearchResult result in mySearcher.FindAll())
             {
                 if (this.CancelationPending)
                 {
                     return;
                 }
                 DirectoryEntry          computer = result.GetDirectoryEntry();
                 ActiveDirectoryComputer comp     = ActiveDirectoryComputer.FromDirectoryEntry(domain, computer);
                 this.FireComputerFound(comp);
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void FireComputerFound(ActiveDirectoryComputer computer)
 {
     if (this.ComputerFound != null)
         this.ComputerFound(computer);
 }