Hi Gerd, thanks for the prompt answer.
You were right, it works fine now !
I thought i had to put both as the ldapfilter requests usually '(xyz)' format.
I will check that to avoid further mistakes...
"Gerd Schneider" wrote:
> I'm not using Quest Extensions so I can not test, but just from a formal
> perspective I assume that the extra single quotes in $lfilter are wrong. Try
>
> $lfilter = "(mail=$mad)"
>
> --
> Gerd
>
>
> "Bruno" wrote:
>
> > Hi,
> > I have a list of email addresses for which i need to find the associated
> > samaccountname in AD.
> > the email addresses are standard (first.last@xxxxxx)
> > Here is the script i use (with Quest extensions)
> >
> > $addresses = Get-Content c:\emaillist.txt
> >
> > Foreach ($mad in $addresses)
> > {
> > $lfilter = "'(mail=$mad)'"
> >
> > $user = Get-QADUser -LdapFilter $lfilter
> >
> > $user
> > }
> >
> > for user first.last@xxxxxx
> > $lfilter would return '(mail=first.last@xxxxxx)'
> >
> > When used as a variable, it won't return anything. However if i make a
> > manual Get-qaduser -ldapfilter and add the $lfilter content to it, it returns
> > the value. Can somebody tell me what i am doing wrong or if there is a better
> > solution for this ?
> > thanks in advance
> > Bruno
> >