• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 890
  • Last Modified:

How to use Saved Queries in Active directory

Hello Experts,

 I am new bee to scripting (Just started with Powershell). However I have been assigned a task to query all the windows server 2003 and windows server 2008 , R2 machines in a perticular domain.

 Now , I have ussed saved queries options before , but not sure how can I use it to only to query server operating systems in a domain.

 Note - I can not use script at this moment.

Any one know what query string I can use , to accomplish my task?

Thanks,

_Prashant_
0
Prashant Girennavar
Asked:
Prashant Girennavar
  • 3
  • 2
1 Solution
 
Krzysztof PytkoActive Directory EngineerCommented:
Sure,

you need to prepare new LDAP query in Saved Queries. Try to follow this path.

1) Open ADUC console
2) Click right mouse button on Saved queries node and choose "New -> Query"
3) Specify query name i.e. "OS Type"
4) Click on "Define query" button
5) From "Find" drop down list choose "Custom search" and select "Advanced" tab
6) You will see a box where you can put LDAP query

try this for querying all 2008 servers
(objectClass=computer)(operatingSystem=*2008*)

Open in new window


and if you wish you may target this query not to all domain but to particular OU. For that you need to change "Query root" by click on "Browse" button

Regards,
Krzysztof
0
 
Prashant GirennavarAuthor Commented:
If I want to add multiple OS in the query then? How I can do it.....

I think it servers only 2008 OS

Thanks,

_Prashant_
0
 
Krzysztof PytkoActive Directory EngineerCommented:
Then you need to add or (|) statement
Try this way

(objectClass=computer)(|(operatingSystem=*2003*)(operatingSystem=*2008*)(operatingSystem=*2012*))

Open in new window


this LDAP query displays all servers with 2003,2008,2012 OS

Krzysztof
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
Prashant GirennavarAuthor Commented:
Thanks for helping Krzysztof.


  I am in my way to learn Powershell....Soon will be knowing these all things :)

_Prashant_
0
 
Krzysztof PytkoActive Directory EngineerCommented:
No problem, Prashant :) I'm glad I could help.
You're on good way to achieve that. Wish you luck

Krzysztof
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now