Quantcast
Viewing all articles
Browse latest Browse all 21975

How to check if an AD attribute is not set

Hi,

I'm guessing this is pretty easy when you know how, but I don't know the syntax. I'm querying AD and want to process users in an OU, but I only want to process users who have proxyAddresses set. How can I do this? Currently my code falls over whenever a user with the proxyAddresses not set is present in my OU. The "=*" hasn't worked

Thanks

Import-ModuleActiveDirectory

$users=([ADSI]"LDAP://OU=test,OU=FIMObjects,OU=Accounts,DC=mydom,DC=local").PSBase.Children

Foreach($userin$users){

#only run on user if attribute exists

if($user.get("Proxyaddresses")=*)

{}}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>