Updating User Workstations through PowerShell

Below is a simple PowerShell script that can be used to search for all currently restricted accounts in Active Directory (accounts who have a value for userWorkstations), and update their list of workstations by adding/removing hosts as needed. This script might be most useful in a scenario where you…

Using PowerShell to Retrieve DCs within a Specific Domain

The following example will use a remote PowerShell session to query a list of domain controllers under a domain name, and return the first result. Note: This does not verify that the domain controller is online and responding to queries! /// <summary> /// Returns a domain controller from the specified…

AD .NET - User's Can't Change Password Attribute (Get/Set)

The following is an example on how to read a user's Can't Change Password attribute in Active Directory using C#. public bool GetCantChangePassword(string userid) { bool cantChange = false; try { DirectoryEntry entry = new DirectoryEntry(string.Format("LDAP://{0},{1}", "OU=Standard Users,OU=Domain", "DC=domain,DC=org")); entry.AuthenticationType = AuthenticationTypes.…