Discussion:
Reading network time from a batch file ?
(too old to reply)
tonyb61
2009-09-17 14:18:49 UTC
Permalink
I'm not sure if this is the correct newsgroup, if anyone can suggest a more
appropriate group I'll post to that ?

I'm writing a batch file to run on a vista machine, that among other tasks,
needs to read the time from our domain, which runs on a W2003 server.The
vista machines are on our network, but not logged into the domain.
So far the only way I've found, is to logon to the domain, connect to a
network drive on say the windows server, read the time, and disconnect drive
and logoff. This seems cumbersome, and as the batch file contains a username
and password, not too secure.
Is there a better way of doing this ? or maybe creating a user account that
has very limited capability, to allow me to read the time back into my batch
file ?

Thanks
Pegasus [MVP]
2009-09-17 16:44:54 UTC
Permalink
Post by tonyb61
I'm not sure if this is the correct newsgroup, if anyone can suggest a
more appropriate group I'll post to that ?
I'm writing a batch file to run on a vista machine, that among other
tasks, needs to read the time from our domain, which runs on a W2003
server.The vista machines are on our network, but not logged into the
domain.
So far the only way I've found, is to logon to the domain, connect to a
network drive on say the windows server, read the time, and disconnect
drive and logoff. This seems cumbersome, and as the batch file contains a
username and password, not too secure.
Is there a better way of doing this ? or maybe creating a user account
that has very limited capability, to allow me to read the time back into
my batch file ?
Thanks
Create a domain account/password that matches your local account/password,
then use the command below to set the local date/time.
net time \\server /set /y
tonyb61
2009-09-18 09:55:46 UTC
Permalink
Post by Pegasus [MVP]
Post by tonyb61
I'm not sure if this is the correct newsgroup, if anyone can suggest a
more appropriate group I'll post to that ?
I'm writing a batch file to run on a vista machine, that among other
tasks, needs to read the time from our domain, which runs on a W2003
server.The vista machines are on our network, but not logged into the
domain.
So far the only way I've found, is to logon to the domain, connect to a
network drive on say the windows server, read the time, and disconnect
drive and logoff. This seems cumbersome, and as the batch file contains a
username and password, not too secure.
Is there a better way of doing this ? or maybe creating a user account
that has very limited capability, to allow me to read the time back into
my batch file ?
Thanks
Create a domain account/password that matches your local account/password,
then use the command below to set the local date/time.
net time \\server /set /y
This is in effect what I do now, but as I said this means that I put a
username and password in the batch file in clear text which allows access to
the domain if the file is read by anyone ? The batch file is not secure.
Regards
Tony
Pegasus [MVP]
2009-09-18 10:21:21 UTC
Permalink
Post by tonyb61
Post by Pegasus [MVP]
Post by tonyb61
I'm not sure if this is the correct newsgroup, if anyone can suggest a
more appropriate group I'll post to that ?
I'm writing a batch file to run on a vista machine, that among other
tasks, needs to read the time from our domain, which runs on a W2003
server.The vista machines are on our network, but not logged into the
domain.
So far the only way I've found, is to logon to the domain, connect to a
network drive on say the windows server, read the time, and disconnect
drive and logoff. This seems cumbersome, and as the batch file contains
a username and password, not too secure.
Is there a better way of doing this ? or maybe creating a user account
that has very limited capability, to allow me to read the time back into
my batch file ?
Thanks
Create a domain account/password that matches your local
account/password, then use the command below to set the local date/time.
net time \\server /set /y
This is in effect what I do now, but as I said this means that I put a
username and password in the batch file in clear text which allows access
to the domain if the file is read by anyone ? The batch file is not
secure.
Regards
Tony
I did not say that you should include an account name & password into a
batch file. I said that you should create a domain account/password that
matches the account/password under which the batch file runs. When you do
this then there is no need to supply any credentials while the batch file
runs.

Loading...