This post discusses how we can search Active Directory using ADSISearcher filters. Using search filters can improve search performance significantly. Consider the following where we create a default ADSISearcher to begin searching Active Directory (AD): $objSearcher=[adsisearcher]”” If we used this … Continue reading →
This post provides a simple example of how we can use ADSI to search groups in Active Directory. You may wish to further optimise this by using LDAP filters. #only groups $objSearcher=[adsisearcher]'(&(objectCategory=group))’ $objSearcher.PageSize = 200 #specify properties to include $colProplist … Continue reading →
This post provides a simple example of how we can use ADSI to search computers in Active Directory. You may wish to further optimise this by using LDAP filters. #only computers $objSearcher=[adsisearcher]'(&(objectCategory=computer))’ $objSearcher.PageSize = 200 #specify properties to include $colProplist … Continue reading →
This post provides a simple example of how we can use ADSI to search users in Active Directory. You may wish to further optimise this by using LDAP filters. $searcher=[adsisearcher]'(&(objectCategory=person)(objectClass=user))’ $searcher.PageSize = 200 $colProplist = “samaccountname” foreach ($i in $colPropList) … Continue reading →
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 →
This post explains how we can use ADSI and FromFileTime to convert datetime attributes in Active Directory to a human-readable date and time. You’ll notice when you return attributes such as lastlogon, lastlogontimestamp and lastpwdset that the format of the … Continue reading →
This post includes an example of how we can use ADSI to list nested members of an AD group. In other words, if the group contains nested groups, it will iteratively search all the members of those nested groups too. … Continue reading →
This post provides a simple example of how we can use ADSI to modify an AD group. In this example, we modify the description attribute of an AD group. You can also use ADSI to clear the attributes for an … Continue reading →
This post provides a simple example of how we can use ADSI to create an AD group. $adGroupType = @{ Global = 0x00000002 DomainLocal = 0x00000004 Universal = 0x00000008 Security = 0x80000000 } #OU containing the AD group $adGroupOU=”OU=Application,OU=Groups,DC=alkanesolutions,DC=co,DC=uk” #AD … Continue reading →
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 →