Solved

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

Posted on 2012-04-12
3
388 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

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

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
An article on effective troubleshooting
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
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…

696 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