Exemple #1
0
        private void buttonMovePC_Click(object sender, EventArgs e)
        {
            try
            {
                using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domain))
                {
                    // find a computer
                    ComputerPrincipal computer = ComputerPrincipal.FindByIdentity(ctx, computername);

                    DirectoryEntry de = (DirectoryEntry)computer.GetUnderlyingObject();
                    de.MoveTo(new DirectoryEntry("LDAP://" + comboBoxOUList.Text));
                    de.CommitChanges();
                    de.Dispose();
                    computer.Dispose();
                }
                System.Windows.Forms.MessageBox.Show(computername + " has been moved to " + comboBoxOUList.Text, "Moving computer to OU", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch (SystemException err)
            {
                System.Windows.Forms.MessageBox.Show(err.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                                     MessageBoxDefaultButton.Button1,
                                                     MessageBoxOptions.DefaultDesktopOnly);
                this.Close();
            }
        }
Exemple #2
0
        public void ComputerPrincipalConstructorTest()
        {
            ComputerPrincipal computer = new ComputerPrincipal(domainContext);

            computer.Dispose();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Exemple #3
0
        public void ComputerPrincipalConstructorTest()
        {
            ComputerPrincipal computer = new ComputerPrincipal(domainContext);

            computer.Dispose();
            // jsimmons - I currently do not see a straightforward
            //   XUnit replacement for Assert.Inconclusive.
            //Assert.Inconclusive("TODO: Implement code to verify target");
        }
        public void ComputerPrincipalConstructorTest()
        {
            if (DomainContext == null)
            {
                return;
            }

            ComputerPrincipal computer = new ComputerPrincipal(DomainContext);

            computer.Dispose();
        }
Exemple #5
0
        public void ComputerPrincipalConstructorTest()
        {
            ComputerPrincipal computer = new ComputerPrincipal(DomainContext);

            computer.Dispose();
        }