• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Setting system time from another machine

I need to set my workstations' time from a local server, and the local server's date & time from a remote server over a WAN connection.  Any ideas on how this can be achieved
0
barendb
Asked:
barendb
1 Solution
 
TimCotteeCommented:
This sample will allow you to determine the data and time on a remote machine:

http://www.btinternet.com/~vbadmincode/code/netremotetod.zip

With this you can then use this API call to set the system date and time.

Private Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
End Type
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Sub Form_Load()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim lpSystemTime As SYSTEMTIME
    lpSystemTime.wYear = 2000
    lpSystemTime.wMonth = 1
    lpSystemTime.wDayOfWeek = -1
    lpSystemTime.wDay = 24
    lpSystemTime.wHour = 23
    lpSystemTime.wMinute = 26
    lpSystemTime.wSecond = 0
    lpSystemTime.wMilliseconds = 0
    'set the new time
    SetSystemTime lpSystemTime
End Sub
0
 
Anthony PerkinsCommented:
Need some help with maintaining your open questions or do you have no interest in following up?  For the record:

Questions Asked 3
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received

Anthony
0
 
barendbAuthor Commented:
For the record, one of the open questions is pending deletion, has been for the last couple of months.  I've decided to delete it because I did not receive a satisfactory answer.

On the other open question, I've posted a comment to the effect of, the first person to respond, get's the points.   If I don't get a response, I'm not going to award points.

As for this question, I'm busy testing Tim's solution and will accept his answer as soon as I've had time to finish testing.

So to answer your question, No I don't need help in maintaining my questions, and I am interested in what happens with them.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Toad224Commented:
I assume they're Windows machines if you're looking to use VB.  Windows workstations can have logon scripts that are set by a server.  You should look into using    "net time /set"  for synchronizing the time.  Try typing "net help time" in a command prompt window.  A Windows NT (NT4, 2000 or XP) server should have the Windows Time service activated.

If you really want to use VB, you should look into the WinAPI function SetSystemTime and winsock.

I hope this helps.  Good luck!
0
 
Anthony PerkinsCommented:
You may want to contact Community Support (http://www.experts-exchange.com/commspt/), both questions are showing "Waiting for Answer":

Remote Access Services Problem Date: 03/14/2001 02:20AM PST
http://www.experts-exchange.com/jsp/qShow.jsp?ta=networkgen&qid=20091389
SQL Server connection error Date: 07/19/2001 03:19AM PST  
http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20153431

Anthony
0
 
barendbAuthor Commented:
Anthony,

I totally forgot about the remote access services question, which does not show under the VB section, where I spend 99% of my time.  I'll go and grade it now.  As for this one, Tim get's the points will also award them now.

Toad 224, thanks for the suggestion, but these machines almost never get rebooted and I need their tiem set on a regular basis.  So the points go to Tim

Barend
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now