search SCP (Service Connection Point) with Powershell

search SCP:   $obj = @() $ADDomain = Get-ADDomain | Select DistinguishedName $DSSearch = New-Object System.DirectoryServices.DirectorySearcher $DSSearch.Filter = ‘(&(objectClass=serviceConnectionPoint)(|(keywords=67661d7F-8FC4-4fa7-BFAC-E1D7794C1F68)(keywords=77378F46-2C66-4aa9-A6A6-3E7A48B19596)))’ $DSSearch.SearchRoot

Weiterlesen

Hide All Disabled Users From GAL

import-module activedirectory   #Find disabled users that do not have the msExchHideFromAddressLists property and add it Get-ADUser -Filter {(mail -like “*”) -and(enabled -eq $false) -and(msExchHideFromAddressLists -notlike “*”)} | Set-adUser -Add @{msExchHideFromAddressLists=”TRUE”}   #Find disabled users that have the msExchHideFromAddressLists property set to false and change to true Get-ADUser -Filter {(mail -like “*”) -and(enabled -eq $false) -and(msExchHideFromAddressLists -eq $false)} | Set-adUser -Replace @{msExchHideFromAddressLists=”TRUE”}     nur auslesen nach OU internal Get-ADUser -Filter {(mail -like “*”) -and(enabled -eq $false) -and(msExchHideFromAddressLists -notlike “*”)} -SearchBase “OU=Internal,OU=Users,DC=ADS,DC=DOMAIN,DC=COM”   external Get-ADUser -Filter {(mail -like “*”)

Weiterlesen