Hi there
im trying to find if a value matches on a certain attribute in Ad and exchange(an attribute that an address list is based on)
so when i try this:
(Get-ADuser user1 -Properties showInAddressBook).showinaddressbook
i get this:
CN=department1,CN=ORG,CN=All Address Lists,CN=Address Lists Container,CN=ORG,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ORG,DC=COM
CN=ORG,CN=All Address Lists,CN=Address Lists Container,CN=ORG,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ORG,DC=COM
CN=Default Global Address List,CN=All Global Address Lists,CN=Address Lists Container,CN=ORG,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ORG,DC=COM
CN=All Users,CN=All Address Lists,CN=Address Lists Container,CN=ORG,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=ORG,DC=COM
then i try this:
if ((Get-ADuser user1 -Properties showInAddressBook).showinaddressbook -contains "department1") {Write-Host " IN department1"}
but the result comes out opposite to the query
-contains return nothing while -notcontains returns true:)
i tried using other things but it doesnt seem to work for some reason ,not sure why
any ideas?
thanks in advance