![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | help with LDAP query I'm trying to do an LDAP query to find all machines ENDING with a specific string. I have no problem finding machines with a prefix, but i can't seem to get the suffix working right. Here's what I'm trying... get-qadcomputer -LdapFilter '(SamAccountName=*end)' i actually want to get all pcs matching a beginning AND end...for example get-qadcomputer -LdapFilter '(&(SamAccountName=start*)(SamAccountName=*end))' and hopefully that would return all computers matching "start*end" like: start123567end start123end etc. So...i can't even get the suffix alone to work...who can tell me what i'm doing wrong? Thanks!! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: help with LDAP query Try this. Most computer sAMAccountName have $ at the end. get-qadcomputer -LdapFilter '(&(sAMAccountName=start*)(sAMAccountName=*end$))' Brandon Shell --------------- Blog: http://www.bsonposh.com/ PSH Scripts Project: www.codeplex.com/psobject BC> I'm trying to do an LDAP query to find all machines ENDING with a BC> specific string. I have no problem finding machines with a prefix, BC> but i can't seem to get the suffix working right. Here's what I'm BC> trying... BC> BC> get-qadcomputer -LdapFilter '(SamAccountName=*end)' BC> BC> i actually want to get all pcs matching a beginning AND end...for BC> example BC> BC> get-qadcomputer -LdapFilter BC> '(&(SamAccountName=start*)(SamAccountName=*end))' BC> BC> and hopefully that would return all computers matching "start*end" BC> like: BC> start123567end BC> start123end BC> etc. BC> So...i can't even get the suffix alone to work...who can tell me BC> what i'm doing wrong? BC> BC> Thanks!! BC> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: help with LDAP query Although Brandon's query is much more efficient, being processed on the server side, you can simply use wildcard characters: PS > get-qadcomputer -name start*end ----- Shay Levi $cript Fanatic http://scriptolog.blogspot.com Quote: > I'm trying to do an LDAP query to find all machines ENDING with a > specific string. I have no problem finding machines with a prefix, > but i can't seem to get the suffix working right. Here's what I'm > trying... > > get-qadcomputer -LdapFilter '(SamAccountName=*end)' > > i actually want to get all pcs matching a beginning AND end...for > example > > get-qadcomputer -LdapFilter > '(&(SamAccountName=start*)(SamAccountName=*end))' > > and hopefully that would return all computers matching "start*end" > like: > start123567end > start123end > etc. > So...i can't even get the suffix alone to work...who can tell me what > i'm doing wrong? > > Thanks!! > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: help with LDAP query Amazing...Thanks!! =) "Brandon Shell [MVP]" wrote: Quote: > Try this. Most computer sAMAccountName have $ at the end. > > get-qadcomputer -LdapFilter '(&(sAMAccountName=start*)(sAMAccountName=*end$))' > > Brandon Shell > --------------- > Blog: http://www.bsonposh.com/ > PSH Scripts Project: www.codeplex.com/psobject > > BC> I'm trying to do an LDAP query to find all machines ENDING with a > BC> specific string. I have no problem finding machines with a prefix, > BC> but i can't seem to get the suffix working right. Here's what I'm > BC> trying... > BC> > BC> get-qadcomputer -LdapFilter '(SamAccountName=*end)' > BC> > BC> i actually want to get all pcs matching a beginning AND end...for > BC> example > BC> > BC> get-qadcomputer -LdapFilter > BC> '(&(SamAccountName=start*)(SamAccountName=*end))' > BC> > BC> and hopefully that would return all computers matching "start*end" > BC> like: > BC> start123567end > BC> start123end > BC> etc. > BC> So...i can't even get the suffix alone to work...who can tell me > BC> what i'm doing wrong? > BC> > BC> Thanks!! > BC> > > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: help with LDAP query oh yeah...and i actually just combined the start and end... i.e. get-qadcomputer -Ldapfilter '(SamAccountName=start*end$)' "Brandon Shell [MVP]" wrote: Quote: > Try this. Most computer sAMAccountName have $ at the end. > > get-qadcomputer -LdapFilter '(&(sAMAccountName=start*)(sAMAccountName=*end$))' > > Brandon Shell > --------------- > Blog: http://www.bsonposh.com/ > PSH Scripts Project: www.codeplex.com/psobject > > BC> I'm trying to do an LDAP query to find all machines ENDING with a > BC> specific string. I have no problem finding machines with a prefix, > BC> but i can't seem to get the suffix working right. Here's what I'm > BC> trying... > BC> > BC> get-qadcomputer -LdapFilter '(SamAccountName=*end)' > BC> > BC> i actually want to get all pcs matching a beginning AND end...for > BC> example > BC> > BC> get-qadcomputer -LdapFilter > BC> '(&(SamAccountName=start*)(SamAccountName=*end))' > BC> > BC> and hopefully that would return all computers matching "start*end" > BC> like: > BC> start123567end > BC> start123end > BC> etc. > BC> So...i can't even get the suffix alone to work...who can tell me > BC> what i'm doing wrong? > BC> > BC> Thanks!! > BC> > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| working LDAP query, well almost.. 800A000D | VB Script | |||
| Query LDAP to get user Telephone | VB Script | |||
| How can I query LDAP in WLM? | Live Mail | |||
| LDAP Group Query Results Limitation | VB Script | |||
| Not all users are retrieved in an LDAP query via ASP | VB Script | |||