![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | How to use a variable as Ldapfilter 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 |
My System Specs![]() |
| | #2 (permalink) | ||||||||||||
| Guest | RE: How to use a variable as Ldapfilter 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:
| ||||||||||||
My System Specs![]() | |||||||||||||
| | #3 (permalink) | ||||||||||||||||||||||||
| Guest | RE: How to use a variable as Ldapfilter 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:
| ||||||||||||||||||||||||
My System Specs![]() | |||||||||||||||||||||||||
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RE: variable identification | Rob Campbell | PowerShell | 1 | 03-28-2007 04:02 AM |
| complex variable | bdsherman@gmail.com | PowerShell | 6 | 02-22-2007 11:01 AM |
| Set-Variable | Fred J. | PowerShell | 3 | 10-25-2006 12:39 PM |
| tab and variable | hn | PowerShell | 8 | 10-20-2006 06:40 AM |
| How can I ensure that a variable is a built-in powershell variable? | Sung M Kim | PowerShell | 7 | 09-22-2006 06:28 PM |