Solved

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

Posted on 2012-04-12
3
384 Views
Last Modified: 2012-04-16
Script that would show the time on all Domain Controllers in active directory
0
Comment
Question by:mjm21
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 39

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

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Suggested Solutions

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now