Solved

Script that would show the time on all Domain Controllers in active directory

Posted on 2012-04-12
3
389 Views
Last Modified: 2012-04-16
Script that would show the time on all Domain Controllers in active directory
0
Comment
Question by:mjm21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Expert Comment

by:Anuroopsundd
ID: 37838740
http://gallery.technet.microsoft.com/scriptcenter/Determine-a-computers-time-4b3063e2

this is powershell script..

Function Get-NTPSource{
 
Param(
    [Parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
    [Alias('Name')]
    [string[]]$Computername=$Env:Computername
    )
 
Process
    {
    foreach ($Computer in $Computername)
        {
        $ntps = w32tm /query /computer:$Computer /source
        new-object psobject -property @{
            Name = $Computer
            NTPSource = $ntps
            }
        }
    }
}
0
 
LVL 40

Accepted Solution

by:
als315 earned 500 total points
ID: 37838797
This is vbs:
Set objOU = GetObject("LDAP://ou=Domain Controllers, dc=YourDomain, dc=local")
objOU.Filter = Array("Computer")
For Each objComputer in objOU
Set objWMIService = GetObject("winmgmts:\\" & objComputer.CN & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_LocalTime")
 
For Each objItem in colItems
    strTime = objItem.Hour & ":" & objItem.Minute & ":" & objItem.Second
    dtmTime = CDate(strTime)
    Wscript.Echo objComputer.CN & ": " & FormatDateTime(dtmTime, vbFormatLongTime)
Next
Next

Open in new window

0
 

Author Comment

by:mjm21
ID: 37853088
Excellent!  Tried the VBscript and worked like a charm.
0

Featured Post

Technology Partners: 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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

688 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