Solved

set system date and time from other PC

Posted on 2003-12-04
11
1,812 Views
Last Modified: 2007-12-19
how do i set system date and time of a PC before it loads to windows? i would like to get the info. from other PC.
0
Comment
Question by:matley
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 8

Accepted Solution

by:
K_2K earned 50 total points
ID: 9880403
If it's NT/2000/XP - the security settings make it extremely difficult to work across the network before a user starts to log on.  most places are content to have something like this in the logon script:
   net time \\Time_PC_Name /set
You can also look into the /setsntp switch if you have NTP servers on your local network.

Good Luck,
2K
(\o/)
0
 
LVL 5

Expert Comment

by:juliancrawford
ID: 9880580
You will need to authenticate prior to using the net time command ..

>net use \\127.0.0.1\ipc$ "mypassword" /u:administrator
The command completed successfully.
<---substitute the ip addy and password to suit

now you can issue the net time command above as per K_2K
0
 

Author Comment

by:matley
ID: 9880842

K_2K,

i'm using it with 98. where i can find that logon script? is it in Autoexec.Bat? and one more thing, i want it to set without prompting for confirmation.
0
 
LVL 5

Expert Comment

by:juliancrawford
ID: 9880866
sorry - didn't realise you were using 98 - disregard my previous post.
0
 
LVL 10

Expert Comment

by:pbarrette
ID: 9883557
Hi matley,

This is going to be extremely difficult for you. Since you are trying to set the time using a time-source on the network, you must have a working network interface and the appropriate drivers loaded. This means that you will need to use MS-DOS based network drivers plus the appropriate network layer stack.

Usually you don't have to worry about these things since Win98 has network drivers and the appropriate network interfaces are initialized when Windows boots up. But since you want to do this before Windows loads...

Another problem you will run into is this: Once you load DOS network drivers, you cannot completely un-load them. If the drivers are loaded when you boot into Win98 it may cause the 32bit Windows network drivers to fail which means that you won't be able to use the network from that system. Or, it may crash Windows entirely.

So.. You're going to habe to find some way to:
1) Load the DOS network drivers and set the time.
2) Reboot the system.
3) Start Win98 without loading the DOS network drivers.

Good luck.

Now, if the requirement to do this before Windows loads is tossed out.. Then it becomes very simple:
net time \\Time_PC_Name /set

Just like K_2K said.

pb
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Expert Comment

by:K_2K
ID: 9888344
This will list your settings,  including the "Logon script" at about the middle:
     net users %USERNAME% /domain
The domain administrator can add the net time command to that script if it's on the logon servers where it belongs.

I agree with pb, the logon script runs before the desktop renders, so even though windows has started there is no serious problem with doing it the simple way instead of going through all the DOS networking hassles.

Of course, if you're smart like some and have already replaced Window's LAN Manager with a third party networking tool just to play around with alternatives - then you may already have networking available at DOS and be able to find in the autoexec.bat file where that is done.  You'll have to user that networking tool to do whatever time commands come with it.

Enjoy,
2K
(\o/)
0
 

Author Comment

by:matley
ID: 9894954
pbarrette,

setting time even after loading windows would be fine. so i created batch file and put it in windows startup folder.  

but i dont want to prompt users for confirmation.

"Do you want to set the local computer's clock to match \\PC_NAME? (Y/N) [Y]:"

 i want it to default to "Y". how can i do that?
0
 
LVL 6

Assisted Solution

by:CowboyJeeper
CowboyJeeper earned 25 total points
ID: 9900506
did you try

net time \\Time_PC_Name /set /y

I know this will work with newer OSs than 98 but not sure if it works in 98
0
 

Author Comment

by:matley
ID: 9908895
gentlemen,

i last thing. i want the MS-DOS window to disappear after executing the batch file.
0
 
LVL 6

Assisted Solution

by:GloomyFriar
GloomyFriar earned 25 total points
ID: 9910777
>i want the MS-DOS window to disappear after executing the batch file.
Create shortcut and set "close after program stop" in its properties.
0
 
LVL 8

Expert Comment

by:K_2K
ID: 9917858
To make the MS-DOS window to disappear after executing the batch file, use the exit command:
   exit

If you use the logon script to do the commands or start the batch file, it will dissappear before the desktop is displayed anyway.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now