![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | LDS query via powershell Hi all, I would like to know if powershell could do a query in a LDS instance on my localhost ? If yes, what are the procedure to do so ? Thanks in advance, Thomas. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: LDS query via powershell Hi H4mm3r, Like ADAM? --- Shay Levy Windows PowerShell MVP blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic H> Hi all, H> H> I would like to know if powershell could do a query in a LDS instance H> on my localhost ? H> If yes, what are the procedure to do so ? H> Thanks in advance, Thomas. H> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: LDS query via powershell AD Lightweight Directory Services is the new name for ADAM in Windows 2008. Short answer is yes you can Easiest way is to use the Quest cmdlets - there examples in the documentation or use directorysearcher $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" then create the searcher as normal -- Richard Siddaway All scripts are supplied "as is" and with no warranty PowerShell MVP Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "Shay Levy [MVP]" wrote: Quote: > Hi H4mm3r, > > Like ADAM? > > > --- > Shay Levy > Windows PowerShell MVP > blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic > > > > H> Hi all, > H> > H> I would like to know if powershell could do a query in a LDS instance > H> on my localhost ? > H> If yes, what are the procedure to do so ? > H> Thanks in advance, Thomas. > H> > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: LDS query via powershell Hi all, Yes, ADAM has been renamed into LDS. I did understand that Quest gives us this feature. So, I knew about the path variable to set. The real trouble for me is how to get the search done. Which command should I use. If you give me a complete example of the search of a CN from the root, it would be great. Thanks in advance, Thomas. On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> wrote: Quote: > AD Lightweight Directory Services is the new name for ADAM in Windows 2008. > > Short answer is yes you can > > Easiest way is to use the Quest cmdlets *- there examples in the documentation > > or use directorysearcher > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > > then create the searcher as normal > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog:http://richardsiddaway.spaces.live.com/ > PowerShell User Group:http://www.get-psuguk.org.uk > > "Shay Levy [MVP]" wrote: Quote: > > Hi H4mm3r, Quote: > > Like ADAM? Quote: > > --- > > Shay Levy > > Windows PowerShell MVP > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: > > H> Hi all, > > H> > > H> I would like to know if powershell could do a query in a LDS instance > > H> on my localhost ? > > H> If yes, what are the procedure to do so ? > > H> Thanks in advance, Thomas. > > H> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: LDS query via powershell The search is the same as an AD search $struser = "BOSCH Herbert" $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" $search = [System.DirectoryServices.DirectorySearcher]$root $search.Filter = "(cn=$struser)" $result = $search.FindOne() if you want to work with the result you will need to do $usr = $result.getdirectoryentry() You can find more on LDAP filters at http://msdn.microsoft.com/en-us/library/aa746475.aspx -- Richard Siddaway All scripts are supplied "as is" and with no warranty PowerShell MVP Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "H4mm3r" wrote: Quote: > Hi all, > > Yes, ADAM has been renamed into LDS. > I did understand that Quest gives us this feature. > So, I knew about the path variable to set. > The real trouble for me is how to get the search done. > Which command should I use. > If you give me a complete example of the search of a CN from the root, > it would be great. > > Thanks in advance, Thomas. > > On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> > wrote: Quote: > > AD Lightweight Directory Services is the new name for ADAM in Windows 2008. > > > > Short answer is yes you can > > > > Easiest way is to use the Quest cmdlets - there examples in the documentation > > > > or use directorysearcher > > > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > > > > then create the searcher as normal > > > > -- > > Richard Siddaway > > All scripts are supplied "as is" and with no warranty > > PowerShell MVP > > Blog:http://richardsiddaway.spaces.live.com/ > > PowerShell User Group:http://www.get-psuguk.org.uk > > > > "Shay Levy [MVP]" wrote: Quote: > > > Hi H4mm3r, Quote: > > > Like ADAM? Quote: > > > --- > > > Shay Levy > > > Windows PowerShell MVP > > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: > > > H> Hi all, > > > H> > > > H> I would like to know if powershell could do a query in a LDS instance > > > H> on my localhost ? > > > H> If yes, what are the procedure to do so ? > > > H> Thanks in advance, Thomas. > > > H> > |
My System Specs![]() |
| | #6 (permalink) |
| | Re: LDS query via powershell Hi all, Thanks for your answer. I knew about the Quest tools. But I don't know how to do the query into the LDS. For example, I want ot search if a CN is in the database. Thanks in advance, Thomas. On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> wrote: Quote: > AD Lightweight Directory Services is the new name for ADAM in Windows 2008. > > Short answer is yes you can > > Easiest way is to use the Quest cmdlets *- there examples in the documentation > > or use directorysearcher > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > > then create the searcher as normal > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog:http://richardsiddaway.spaces.live.com/ > PowerShell User Group:http://www.get-psuguk.org.uk > > "Shay Levy [MVP]" wrote: Quote: > > Hi H4mm3r, Quote: > > Like ADAM? Quote: > > --- > > Shay Levy > > Windows PowerShell MVP > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: > > H> Hi all, > > H> > > H> I would like to know if powershell could do a query in a LDS instance > > H> on my localhost ? > > H> If yes, what are the procedure to do so ? > > H> Thanks in advance, Thomas. > > H> |
My System Specs![]() |
| | #7 (permalink) |
| | Re: LDS query via powershell Connect-QADService -svc "localhost:389" Get-QADuser 'CN=Test1,CN=Users,DC=domain,DC=com' --- Shay Levy Windows PowerShell MVP blog: http://blogs.microsoft.co.il/blogs/ScriptFanatic H> Hi all, H> H> Thanks for your answer. H> I knew about the Quest tools. H> But I don't know how to do the query into the LDS. H> For example, I want ot search if a CN is in the database. H> Thanks in advance, Thomas. H> H> On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> H> wrote: H> Quote: Quote: >> AD Lightweight Directory Services is the new name for ADAM in Windows >> 2008. >> >> Short answer is yes you can >> >> Easiest way is to use the Quest cmdlets - there examples in the >> documentation >> >> or use directorysearcher >> >> $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" >> >> then create the searcher as normal >> >> -- >> Richard Siddaway >> All scripts are supplied "as is" and with no warranty >> PowerShell MVP >> Blog:http://richardsiddaway.spaces.live.com/ >> PowerShell User Group:http://www.get-psuguk.org.uk >> "Shay Levy [MVP]" wrote: >> Quote: >>> Hi H4mm3r, >>> >>> Like ADAM? >>> >>> --- >>> Shay Levy >>> Windows PowerShell MVP >>> blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic >>> H> Hi all, >>> H> >>> H> I would like to know if powershell could do a query in a LDS >>> instance >>> H> on my localhost ? >>> H> If yes, what are the procedure to do so ? >>> H> Thanks in advance, Thomas. >>> H> |
My System Specs![]() |
| | #8 (permalink) |
| | Re: LDS query via powershell Hi all, Thanks Richard. Based on your example, I was able to make it works : $strtofind = "youpi" $root = [ADSI] "LDAP://localhost:389/dc=XXX,dc=YYY" $searcher = new-object System.DirectoryServices.DirectorySearcher($root) $searcher.Filter = "(cn=$strtofind)" $result = $searcher.FindAll() echo $result Now, I'll try to update the record. Do you know a good place for all the basic documentation of the PowerShell language and API ? On 8 juil, 14:39, RichS [MVP] <RichS...@xxxxxx> wrote: Quote: > The search is the same as an AD search > > $struser = "BOSCH Herbert" > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > $search = [System.DirectoryServices.DirectorySearcher]$root > $search.Filter = "(cn=$struser)" > $result = $search.FindOne() > > if you want to work with the result *you will need to do > > $usr = $result.getdirectoryentry() > > You can find more on LDAP filters at > > http://msdn.microsoft.com/en-us/library/aa746475.aspx > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog:http://richardsiddaway.spaces.live.com/ > PowerShell User Group:http://www.get-psuguk.org.uk > > "H4mm3r" wrote: Quote: > > Hi all, Quote: > > Yes, ADAM has been renamed into LDS. > > I did understand that Quest gives us this feature. > > So, I knew about the path variable to set. > > The real trouble for me is how to get the search done. > > Which command should I use. > > If you give me a complete example of the search of a CN from the root, > > it would be great. Quote: > > Thanks in advance, Thomas. Quote: > > On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> > > wrote: Quote: > > > AD Lightweight Directory Services is the new name for ADAM in Windows2008. Quote: Quote: > > > Short answer is yes you can Quote: Quote: > > > Easiest way is to use the Quest cmdlets *- there examples in the documentation Quote: Quote: > > > or use directorysearcher Quote: Quote: > > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" Quote: Quote: > > > then create the searcher as normal Quote: Quote: > > > -- > > > Richard Siddaway > > > All scripts are supplied "as is" and with no warranty > > > PowerShell MVP > > > Blog:http://richardsiddaway.spaces.live.com/ > > > PowerShell User Group:http://www.get-psuguk.org.uk Quote: Quote: > > > "Shay Levy [MVP]" wrote: > > > > Hi H4mm3r, Quote: Quote: > > > > Like ADAM? Quote: Quote: > > > > --- > > > > Shay Levy > > > > Windows PowerShell MVP > > > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: Quote: > > > > H> Hi all, > > > > H> > > > > H> I would like to know if powershell could do a query in a LDS instance > > > > H> on my localhost ? > > > > H> If yes, what are the procedure to do so ? > > > > H> Thanks in advance, Thomas. > > > > H> |
My System Specs![]() |
| | #9 (permalink) |
| | Re: LDS query via powershell Hi all, Thanks Richard. Based on your example, I was able to make it works : $strtofind = "youpi" $root = [ADSI] "LDAP://localhost:389/dc=XXX,dc=YYY" $searcher = new-object System.DirectoryServices.DirectorySearcher($root) $searcher.Filter = "(cn=$strtofind)" $result = $searcher.FindAll() echo $result Now, I'll try to update the record. Do you know a good place for all the basic documentation of the PowerShell language and API ? On 8 juil, 14:39, RichS [MVP] <RichS...@xxxxxx> wrote: Quote: > The search is the same as an AD search > > $struser = "BOSCH Herbert" > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > $search = [System.DirectoryServices.DirectorySearcher]$root > $search.Filter = "(cn=$struser)" > $result = $search.FindOne() > > if you want to work with the result *you will need to do > > $usr = $result.getdirectoryentry() > > You can find more on LDAP filters at > > http://msdn.microsoft.com/en-us/library/aa746475.aspx > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog:http://richardsiddaway.spaces.live.com/ > PowerShell User Group:http://www.get-psuguk.org.uk > > "H4mm3r" wrote: Quote: > > Hi all, Quote: > > Yes, ADAM has been renamed into LDS. > > I did understand that Quest gives us this feature. > > So, I knew about the path variable to set. > > The real trouble for me is how to get the search done. > > Which command should I use. > > If you give me a complete example of the search of a CN from the root, > > it would be great. Quote: > > Thanks in advance, Thomas. Quote: > > On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> > > wrote: Quote: > > > AD Lightweight Directory Services is the new name for ADAM in Windows2008. Quote: Quote: > > > Short answer is yes you can Quote: Quote: > > > Easiest way is to use the Quest cmdlets *- there examples in the documentation Quote: Quote: > > > or use directorysearcher Quote: Quote: > > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" Quote: Quote: > > > then create the searcher as normal Quote: Quote: > > > -- > > > Richard Siddaway > > > All scripts are supplied "as is" and with no warranty > > > PowerShell MVP > > > Blog:http://richardsiddaway.spaces.live.com/ > > > PowerShell User Group:http://www.get-psuguk.org.uk Quote: Quote: > > > "Shay Levy [MVP]" wrote: > > > > Hi H4mm3r, Quote: Quote: > > > > Like ADAM? Quote: Quote: > > > > --- > > > > Shay Levy > > > > Windows PowerShell MVP > > > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: Quote: > > > > H> Hi all, > > > > H> > > > > H> I would like to know if powershell could do a query in a LDS instance > > > > H> on my localhost ? > > > > H> If yes, what are the procedure to do so ? > > > > H> Thanks in advance, Thomas. > > > > H> |
My System Specs![]() |
| | #10 (permalink) |
| | Re: LDS query via powershell Hi all, Thanks Richard. Based on your example, I was able to make it works : $strtofind = "youpi" $root = [ADSI] "LDAP://localhost:389/dc=XXX,dc=YYY" $searcher = new-object System.DirectoryServices.DirectorySearcher($root) $searcher.Filter = "(cn=$strtofind)" $result = $searcher.FindAll() echo $result Now, I'll try to update the record. Do you know a good place for all the basic documentation of the PowerShell language and API ? Once agin, thanks for your input, Thomas. On 8 juil, 14:39, RichS [MVP] <RichS...@xxxxxx> wrote: Quote: > The search is the same as an AD search > > $struser = "BOSCH Herbert" > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" > $search = [System.DirectoryServices.DirectorySearcher]$root > $search.Filter = "(cn=$struser)" > $result = $search.FindOne() > > if you want to work with the result *you will need to do > > $usr = $result.getdirectoryentry() > > You can find more on LDAP filters at > > http://msdn.microsoft.com/en-us/library/aa746475.aspx > > -- > Richard Siddaway > All scripts are supplied "as is" and with no warranty > PowerShell MVP > Blog:http://richardsiddaway.spaces.live.com/ > PowerShell User Group:http://www.get-psuguk.org.uk > > "H4mm3r" wrote: Quote: > > Hi all, Quote: > > Yes, ADAM has been renamed into LDS. > > I did understand that Quest gives us this feature. > > So, I knew about the path variable to set. > > The real trouble for me is how to get the search done. > > Which command should I use. > > If you give me a complete example of the search of a CN from the root, > > it would be great. Quote: > > Thanks in advance, Thomas. Quote: > > On 7 juil, 21:31, RichS [MVP] <RichS...@xxxxxx> > > wrote: Quote: > > > AD Lightweight Directory Services is the new name for ADAM in Windows2008. Quote: Quote: > > > Short answer is yes you can Quote: Quote: > > > Easiest way is to use the Quest cmdlets *- there examples in the documentation Quote: Quote: > > > or use directorysearcher Quote: Quote: > > > $root = [ADSI] "LDAP://localhost:389/dc=xyz,dc=com" Quote: Quote: > > > then create the searcher as normal Quote: Quote: > > > -- > > > Richard Siddaway > > > All scripts are supplied "as is" and with no warranty > > > PowerShell MVP > > > Blog:http://richardsiddaway.spaces.live.com/ > > > PowerShell User Group:http://www.get-psuguk.org.uk Quote: Quote: > > > "Shay Levy [MVP]" wrote: > > > > Hi H4mm3r, Quote: Quote: > > > > Like ADAM? Quote: Quote: > > > > --- > > > > Shay Levy > > > > Windows PowerShell MVP > > > > blog:http://blogs.microsoft.co.il/blogs/ScriptFanatic Quote: Quote: > > > > H> Hi all, > > > > H> > > > > H> I would like to know if powershell could do a query in a LDS instance > > > > H> on my localhost ? > > > > H> If yes, what are the procedure to do so ? > > > > H> Thanks in advance, Thomas. > > > > H> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Is there a way to query DNS from powershell? | PowerShell | |||
| PerfMon PowerShell Query | PowerShell | |||
| Running WMI Query in without Powershell or VBS | PowerShell | |||
| Query NT4 Domain from Powershell | PowerShell | |||
| Query for ms-ds-creatorsid from Powershell | PowerShell | |||