We help IT Professionals succeed at work.
Get Started

Script to query time (net time) on all servers via accessing the AD schema

mikemost asked
Last Modified: 2012-05-05
Greetings All,

I've searched around EE & Google but am yet to find a good sample script to get me started. What I'm looking for is either a Winbatch sample script, or windows command file that can query the active directory schema, or a collection of OU's, and go out to the servers within the OU's and retrieve the current time (run a net time command) and output the results into a file, preferably a .csv but an .xls or even .txt file would suffice just fine. I believe this should be possible through WMI, if that proves to be to big of a hurdle, I could attempt to use a script which could simply rely on pre-determined list. The benefit of going into AD would be avoiding calculating every single server in our environment as my company is a small enterprise with god knows how many virtual servers! It would also be great if such a script could specify in the output servers that do not respond into a separate category in the output file due to certian VM's being powered off at certain times. Any and all assistance is appreciated and this is certainly a 500 point question.

Best Regards,
Mike Mostwill
Watch Question
Most Valuable Expert 2012
Top Expert 2014
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE