[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

DC Service Pack level

Posted on 2010-01-02
6
Medium Priority
?
346 Views
Last Modified: 2012-05-08
Dear All,

I need to apply a command which can result me all Domain Controller which they have Service Pack less than SP2. How I can do this?
Note: all my domian controller installed by windows 2003

Thanks
0
Comment
Question by:Arabsoft-ACS
  • 4
  • 2
6 Comments
 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 26161110
Use dsquery as below where replacing dc=domainname,dc=local with the LDAP-name of your own domain (split domainname.local and prefix all parts with DC= with "," as separator)

dsquery * -filter "(!operatingsystemservicepack=*2*)" "ou=domain controllers,dc=domainname,dc=local" -attr name
0
 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 26161117
After posting, I saw that it would propably be interesting to also see the OS-ver and SP in the output

dsquery * -filter "(!operatingsystemservicepack=*2*)" "ou=domain controllers,dc=domainname,dc=local" -attr name operatingsystem operatingsystemservicepack
0
 

Author Comment

by:Arabsoft-ACS
ID: 26161137
Dear henjoh09,

This command give me a lot of info which i don't need.

I just need all domain controller Names which they have windows 2003 SP1

Thanks
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 26161211
Sorry, I runned the command on a domain that has only a single DC without replication and only returned the requested objects. Re-runned in another AD-forest with replication caused as your followup unnecessary results.

Change the filter to only search for computer objects

-filter "(&(objectclass=computer)(!operatingsystemservicepack=*2*))"

or search for all objects that has the operatingsystemservicepack set, but doesn't contain the value 2

-filter "(&(operatingsystemservicepack=*)(!operatingsystemservicepack=*2*))"
0
 

Author Comment

by:Arabsoft-ACS
ID: 26161285
Dear Henjoh09,

When i run the command, it's list me all computers whith the following result:

"CN=SAPJBX,OU=Servers,DC=ho,DC=almarai,DC=com"

I'm looking for a command give me the only Domain Controller which have Windwos 2003 SP1 like the following:

HQDC1
HQDC1


Thanks
0
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 2000 total points
ID: 26161322
When not using -attr to specify what attributes shall be returned, it will return the DN of the object.

Only return computer name:

dsquery * -filter "(&(objectclass=computer)(!operatingsystemservicepack=*2*))" "OU=Domain Controllers,DC=almarai,DC=com" -attr name


Computer name with OS-version and SP:

dsquery * -filter "(&(objectclass=computer)(!operatingsystemservicepack=*2*))" "OU=Domain Controllers,DC=almarai,DC=com" -attr name operatingsystem operatingsystemservicepack
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Here's a look at newsworthy articles and community happenings during the last month.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question