Page 1 of 1 1
Topic Options
#135301 - 2005-03-11 01:58 PM How to change windows date ?
Bruno_Leveque Offline
Fresh Scripter

Registered: 2005-03-11
Posts: 9
Loc: Paris, France
Hi everybody,

I'm seeking a simple method to change the date of Windows (ex : 2005/03/11 -> 2005/03/13). I didn't find any suitable function in Kixtart handbook, an idea?

Thank you in advance
_________________________
_________________ Bruno Lévêque http://pronof1.fr

Top
#135302 - 2005-03-11 02:19 PM Re: How to change windows date ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
KiX does not have an intrinsic command or function to change the date. For that, you would have to either drop to DOS and use the W32Tm or TIME command, or use COM or WMI. Perhaps you should give some background on why you would want to change the date in a script. If you are running Active Directory, you can expect major problems if you muck with the date/time.

You should have all the computers sync time with the W32Time/W32Tm service.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135303 - 2005-03-11 02:30 PM Re: How to change windows date ?
Bruno_Leveque Offline
Fresh Scripter

Registered: 2005-03-11
Posts: 9
Loc: Paris, France
I already tested the DOS commande "date" but I need a command with which I would be able to pass an argument (and not have a blocking prompt) :

date [new_date]

The goal is simply to test one of my kixtart scripts from which result differs according to the system date.
_________________________
_________________ Bruno Lévêque http://pronof1.fr

Top
#135304 - 2005-03-11 02:39 PM Re: How to change windows date ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There are lots of ways to show results. You could log to a file or the registry, or return ERRORLEVEL with the EXIT command.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#135305 - 2005-03-11 02:44 PM Re: How to change windows date ?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I just tried this on WinXP and it did not block ...

C:\>date 2005-03-12
C:\>

Of course, it helps to be a local admin when your setting the clock too.

Top
#135306 - 2005-03-11 02:48 PM Re: How to change windows date ?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
another way you could do this is to -
Code:

C:\Documents and Settings\Kent>echo 3/13/2005 | date
The current date is: Fri 03/11/2005
Enter the new date: (mm-dd-yy) 3/13/2005



This you would have to shell out for from KiX. The caveat to this would be if you have NNTP setup on the domain and you point your clients to it. Once they talk to the server that goes to the atomic clock, the date/time will change back if using W32time/W32TM as Les suggested.

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#135307 - 2005-03-11 02:50 PM Re: How to change windows date ?
Bruno_Leveque Offline
Fresh Scripter

Registered: 2005-03-11
Posts: 9
Loc: Paris, France
Quote:

I just tried this on WinXP and it did not block ...

C:\>date 2005-03-12
C:\>

Of course, it helps to be a local admin when your setting the clock too.




Ok this is what I wanted

Thanks a lot !
_________________________
_________________ Bruno Lévêque http://pronof1.fr

Top
#135308 - 2005-03-11 07:58 PM Re: How to change windows date ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Use the Windows Time Service to keep time synchronizes as is required for AD or use SETTIME under Windows 9x.
_________________________
There are two types of vessels, submarines and targets.

Top
#135309 - 2005-03-11 11:15 PM Re: How to change windows date ?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
W32Time..
Windows NT it is an add-in, W2k+ is in-build.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#135310 - 2005-03-12 06:27 AM Re: How to change windows date ?
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Just a small technical clarification.

AD requires time synchronization AND a service named "W32Time" to be present. It does not require "W32Time" to actually function.

We run a SNTP server everywhere, and have W32Time disabled, since the SNTP service provides higher accuracy for our application environment. Oddly, when joining a server to an AD, the system craps out if a service called W32Time isn't present or can't be started. I say "a service called W32Time" because that service isn't required to do anything if you have good time sync! I've replaced the W32Time defined binary with CMD.EXE on a test server and was able to join the AD, when it fails if the W32Time service is removed entirely.

Maybe irrelevent, but maybe interesting trivia for some, too.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#135311 - 2005-03-12 02:01 PM Re: How to change windows date ?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yes, interesting trivia. What I should have said is that AD requires time to be synchronized to within 5 seconds by default. I was not to imply that the Windows Time Service must be used to achieve this synchronization, though. My bad.
_________________________
There are two types of vessels, submarines and targets.

Top
#135312 - 2005-03-12 02:21 PM Re: How to change windows date ?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yes, it is all interesting trivia, but trivia is all it is since this thread is not about keeping time syncronized but rather about using the time as a visual indicator of script action.

I thinks doing so is a very VERY V E R Y bad idea as there are lots of better ways to do it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.062 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org