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
Solved

Setting system time from another machine

Posted on 2002-06-05
6
170 Views
Last Modified: 2013-11-13
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
Comment
Question by:barendb
6 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 100 total points
ID: 7055868
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7056446
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
 
LVL 1

Author Comment

by:barendb
ID: 7056561
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:Toad224
ID: 7056819
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
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7058352
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
 
LVL 1

Author Comment

by:barendb
ID: 7058618
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Microsoft Access combo box help 2 49
vb6 connector to mongodb 2 117
Add and format columns in vb6 7 63
I need help embedding an image as HTML in my vb.net application 3 73
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

839 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