|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
There are lots of ways to show results. You could log to a file or the registry, or return ERRORLEVEL with the EXIT command. |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
another way you could do this is to - Code:
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 |
||||||||
|
|
|||||||
Quote: Ok this is what I wanted Thanks a lot ! |
||||||||
|
|
|||||||
Use the Windows Time Service to keep time synchronizes as is required for AD or use SETTIME under Windows 9x. |
||||||||
|
|
|||||||
W32Time.. Windows NT it is an add-in, W2k+ is in-build. Kent |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. |