Use ADSI to Set and Clear Active Directory Attributes

This post provides an example of how we can use ADSI to set and clear Active Directory Attributes.  We search for a user called “alkaneuser” and set or clear the department attribute. $objSearcher=[adsisearcher]'(&(objectCategory=person)(objectClass=user)(sAMAccountName=alkaneuser))’ $colProplist = “samaccountname”,”department” foreach ($i in $colPropList) … Continue reading

Use ADSI to Delete an AD Group

This post provides a simple example of how we can use ADSI to delete an AD group. #OU containing the AD group $adGroupOU=”OU=Application,OU=Groups,DC=alkanesolutions,DC=co,DC=uk” #AD group name $addADGroup = “CN=alkane_ad_group” #Full distinguished name of AD group $distinguishedName = “$addADGroup,$adGroupOU” #check if … Continue reading