473,799 Members | 3,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the current date/time stamp from a network computer?

Hi All,

I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.

This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.

Is there any function or command in CSHARP which lets me grab a
current date/time from a network computer?

Please let me know, you could save me a lot of time :)

Thanks,
JK

Oct 29 '07 #1
6 2303
Hey,

No offence but if you are the network admin would it not be easier to send a
batch down on next login and force the Internet Time to reset to the most
current "real time"? I admit I might be going off at a tangent slightly but
it could do the job and save you tons of time having to write a tiny app to
do the work windows can on it's own - IF you tell it *grin*...

Something like this in a .bat file
<code>
net stop w32time
w32tm /unregister [ignore error message]
w32tm /unregister [enter a second time]
w32tm /register
reg add hklm\system\cur rentcontrolset\ services\w32tim e\parameters\ /v
NtpServer /t reg_sz /d time.nist.gov /f
net start w32time
</code>

I think there is/was an error with time.windows.co m or another of the time
prefix ones as they don't/won't accept requests in TIME format anymore -
nist.gov will cause no issues.

HTH
Brendon
<tr********@gma il.comwrote in message
news:11******** **************@ y27g2000pre.goo glegroups.com.. .
Hi All,

I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.

This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.

Is there any function or command in CSHARP which lets me grab a
current date/time from a network computer?

Please let me know, you could save me a lot of time :)

Thanks,
JK
Oct 29 '07 #2
Hi,

I was really looking for an answer to my problem...

Problem is, you see, that we are not syncing (for various reasons)
with time servers.
So I need to know if the time is correct some other way and this would
be the best.

Anyhow, is someone here capable to answer the question? :)

Can I remotely get the network computer's time and date?

Oct 29 '07 #3
Assuming that WMI is running on those machines, you should be able to
use the classes in the System.Manageme nt namespace to connect to the WMI
service on the machines and get the WMI instance of Win32_Operating System.
From there, you would get the LocalDateTime property from the instance,
which will return the local date and time on the machine.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<tr********@gma il.comwrote in message
news:11******** **************@ e9g2000prf.goog legroups.com...
Hi,

I was really looking for an answer to my problem...

Problem is, you see, that we are not syncing (for various reasons)
with time servers.
So I need to know if the time is correct some other way and this would
be the best.

Anyhow, is someone here capable to answer the question? :)

Can I remotely get the network computer's time and date?

Oct 29 '07 #4
<tr********@gma il.comwrote in message
news:11******** **************@ y27g2000pre.goo glegroups.com.. .
Hi All,

I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.

This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.

Is there any function or command in CSHARP which lets me grab a
current date/time from a network computer?

Please let me know, you could save me a lot of time :)

Thanks,
JK

No need to write any code at all, just get a copy of the PsTools from,
<http://www.microsoft.c om/technet/sysinternals/utilities/psexec.mspxand
use "psexec" to run the time command remotely.

Willy.
Oct 29 '07 #5

One solution we came up with syncing with machines that didn't support
WMI was to write a file to the computer and then check the latest
write time. It worked well for our needs which didn't require a high
degree of accuracy (within a second was fine, but technique is closer
than that).

Of course it requires write access... :-)

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Mon, 29 Oct 2007 07:47:27 -0700, tr********@gmai l.com wrote:
>Hi All,

I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.

This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.

Is there any function or command in CSHARP which lets me grab a
current date/time from a network computer?

Please let me know, you could save me a lot of time :)

Thanks,
JK
Oct 30 '07 #6
On Oct 29, 2:47 pm, trytobr...@gmai l.com wrote:
Hi All,

I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.

This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.

Is there any function or command in CSHARP which lets me grab a
current date/time from a network computer?

Please let me know, you could save me a lot of time :)

Thanks,
JK
Hi there,
Do a Google for NetRemoteTOD c#. There are some examples that PInvoke
that should do what you want.

Cheers,

Steve
http://dunnhq.com

Oct 30 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
19634
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance, Don Following running on client-side:
9
3229
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database and not the file itself. To do this I will need to have a File class property for Create time and date that will let me "set" the Create time and date of the file to my own chooseing. The VB file class does not appear to have the ability
6
13596
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital dot org
5
2109
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just the functions that find the day of week and a function that can (in this case) subtract 3 days to get sunday and add 7 for saterday. I can do the rest. Desmond.
3
17614
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the user creates a new record that date and time stamp is populating as well as if the user modifies the data, that date and time stamp is populationg. Whereby if the record was created yesterday, and the user modified the record today, i would see...
8
2430
by: Trev | last post by:
Hi Can anyone point me in the right direction here, I would like to open a table in access 2003 by date. I have an asp web page which needs to read data from a table with each days today's date (which ever day that is) then a new table is created with today's date. Example: I have a table called 17-may-2007 my ASP page reads this table for 24hours then tomorrow (12:00 midnight 18th) I will have a new table called 18-may-2007 and the...
4
6810
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form allows the employee to enter their UserID and select "Login" or "Logout" and then click a submit. When the submit button is clicked, I want the application to dum the NT Userename, UserID, status (Login or Logout) and a date/time stamp into an MS Access...
6
9555
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get their current date and time stamps. This is mostly because of coming DST changes and having hundreds of machines on the network, I don't want to connect remotely to every and each server to see if the time is correct.
16
4468
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after 22:02:51? (24 hour day is fine) How about the date after 02/28/04 is 02/29/04, or the date after 09/30/08 is 10/01/08?
29
4044
by: WannabePrgmr | last post by:
I am trying to display total numbers of data in a textbox, "Textbox200" on a form "Master", but I only want to display current daily data. I currently get the data from: Me.Text200 = DCount("", "") which gets the total "Live" data from the "LIVEquery", which is updated in the Form_Current. I would like to change this to look at the current date and only query for data entered during that date. I have a textboxx with the following in...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10247
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9067
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.