Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Retrieving Current date/time from Exchange Server

Posted on 2001-09-12
9
Medium Priority
?
249 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
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.

 
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 200 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

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.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

721 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