Solved

Setting system time from another machine

Posted on 2002-06-05
6
172 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
[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
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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

691 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