Solved

Retrieving Current date/time from Exchange Server

Posted on 2001-09-12
9
243 Views
Last Modified: 2008-03-17
I want to generate a call report number, but would like to get the DATE and TIME (to use in creating the code number) from the server as opposed to local machines.

Any help would be appreciated.

JT
0
Comment
Question by:cyrens
[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
  • 2
  • 2
  • +2
9 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 6478224
You should be able to get the date and time from the server by using the net time command
net time \\servername
have you thought about setting up your server as a time source server and syncronizing the workstations to it?
0
 

Expert Comment

by:joe_lafferty
ID: 6479201
following on from vinny,

do you use scripts to log on and map drives etc;?
net time \\servername /set /y

will update the workstations for you at each logon.

0
 

Author Comment

by:cyrens
ID: 6480800
I'm sorry. I wasn't clear in my question. I am writing VB code to retrieve the date and time from the server. I do not work on Exchange servers, just trying to write some code for an application.


jt
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 28

Expert Comment

by:vinnyd79
ID: 6480831
Then what about using the net time command from VB

' write batch file from vb to redirect output of net time to a temp file.

Open "C:\Tmptime.bat" for output as #1
Print #1,"net time \\servername > C:\tmptime"
Close #1

' execute the batch file
Shell("C:\Tmptime.bat")

' get rid of the batch file
Kill("C:\Tmptime.bat")

' open temp file and get the date and time.
Open "C:\tmptime" for input as #1
Line input #1,G$
MsgBox(G$)
Close #1

' kill tempfile or you can let it get overwritten on next use.
Kill("C:\tmptime")
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 50 total points
ID: 6480865
In the above example you can hide the dos window by shelling to the batch file and using vbhide like so:

' execute the batch file
Shell("C:\Tmptime.bat",vbHide)

You can also shell command interpretor to get output of net time,but then you have to check the OS so you know whether to shell to C:\command.com or C:\winnt\system32\cmd.exe.

If you want to try that this is for winnt:
Dim A
A = Shell("c:\winnt\system32\cmd.exe /c net time \\servername > C:\tmptime", vbHide)

win98:

Dim A
A = Shell("c:\command.com /c net time \\servername > C:\tmptime", vbHide)

Then you can open the temp file to get your data just like above example:

' open temp file and get the date and time.
Open "C:\tmptime" for input as #1
Line input #1,G$
MsgBox(G$)
Close #1



Hope this helps


0
 
LVL 16

Expert Comment

by:Neo_mvps
ID: 6482553
If you are working strictly with NT/2000 workstations and servers, why not use the Win32 API?  (See NetRemoteTOD)
0
 

Expert Comment

by:amp072397
ID: 6714118
Hello everyone.

We are cleaning up this topic area. This question is considered to be *outdated* and we would like you to move on with it.

Toward that end, we graciously request the following:

-----Askers-----

*Do NOT award points to me.

*Stay active in your question. If you asked this question and have not yet responded to the comments given by experts, please do so as soon as possible, even if it is just to say "I haven't been able to try that yet." If there are many comments, please address them all. If the suggestions given did not help, please give particulars such as error messages or other events that may have occurred. If the experts have asked questions, please respond to them to help them find a resolution to your issue. Please do not ignore them.

*If this issue remains unresolved, you may want to post a new, 0-point question here in this topic area with a link to this question in it to attract other experts.

*Award points for solutions. If one of the suggestions did work or if an expert put in a good effort toward resolving your issue, please award the points to that expert by clicking on the button above that expert's post that says "Accept comment as answer".

*If you have resolved this issue in another manner, please share it with us. We will refund your points and store the question in the database so others might get value from it.

*If you have given up on this issue, and prefer to delete it, you can request that, but the experts may choose to argue that they have worked hard to help you, and the moderator will make final determination if necessary.

*Most importantly, be fair in your grading. Please see guidelines for grading at
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
If you give any grade less than an A without stating why, the grade will be changed upon request by the expert.

Thanks very much for being fair to our experts.



-----Experts-----

*Do not provide further support to this question unless the Asker responds that it is not yet resolved and wishes to continue to get help.

*If you truly believe that your answer is the best one that has been provided, please state which comment you made that you believe to be correct. If no one argues your comment, you will be awarded the points.

*If you would like to *vote* for another expert's comment, feel free to do so. Likewise, feel free to argue (nicely) any points that other experts make. We want everyone's input to be considered. Unless it is really unavoidable, vote only for one expert's response--it is quite a bit of work to split points, and many people come and go from the site and never see the "Points for" questions.

*Please don't thank the moderator for granting points to you. This only causes more email for the moderator, and I can personally attest to literally 100s of emails a day. Your thoughts are no less appreciated! We are experts too.

*Finally, if you ever question a moderator's determination, don't hesitate to do so right in the question in question. If you feel you want to voice your comment privately, email me at amp@experts-exchange.com.

Your input is extremely valuable and very much appreciated.

thank you
amp
community support moderator
0
 

Author Comment

by:cyrens
ID: 6714243
The project I was working on was cancelled so I never had a chance to try any of the options. I did close this out (or at least thought I did) some weeks ago. Still, the answer was acceptable.  Thanks vinny.
0
 

Expert Comment

by:amp072397
ID: 6714461
Thank YOU, Vinny!

amp
community support moderator
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

636 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