Page 1 of 1 1
Topic Options
#47637 - 2003-11-07 01:58 PM Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi guys & galls

I know i should be using W32TIME [Wink] BUT we are in the middle of a migration and I havent got time to push it out (especially when we will have it when we move to 2003)

But i am having problems at the moment with setting the time.
I have changed the permissions for changing the time using NTRIGHTS.exe but am having a problem with shelling net time. I know I can put this in my login script but was wondering if it was possible to set the time at the same time as the permissions change?
I have whipped up this little number below using a script I found on this site (sorry to the author but I cannot remember you name!!)

code:
  
Break on


Open (1,"\\MYPC\copy\aaron.txt")

Do
$compname = ReadLine(1)

Shell "%COMSPEC% /c ntrights.exe +r SeSystemtimePrivilege -u Everyone -m $compname"

Shell "cmd /c net time \\server /set /y"


Until $compname = ""

I have tried using settime but this also doesnt work? HELP !!!!

Also is it possible to revert the permissions after the time has been set?

[ 07. November 2003, 14:06: Message edited by: AzzerShaw ]
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47638 - 2003-11-07 02:52 PM Re: Shelling Net Time
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Doesn't the KiXtart native command SETTIME work?

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

Top
#47639 - 2003-11-07 03:17 PM Re: Shelling Net Time
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
quote:
I havent got time to push it out
Unless you are talking about NT4 clients, W32Tm.exe is already running as a service. The effort required to "push it out" as you say, is the same as your proposed hack. THe only problem with your hack is that if users manually change the time, it will most assuredly break your kerberos authentication!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#47640 - 2003-11-07 03:18 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Nope tried this script and this doesnt work either, should the changes happen straight away?

code:
  
Break on


Open (1,"\\mypc\copy\aaron.txt")

Do
$compname = ReadLine(1)

Shell "%COMSPEC% /c ntrights.exe +r SeSystemtimePrivilege -u Everyone -m $compname"

SetTime "\\timeserver"

Until $compname = ""

_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47641 - 2003-11-07 03:22 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hi Les

Yes I am talking about NT 4.0, sorry should of said.

Do you know if it is possible to revert the changes back afterwards ?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47642 - 2003-11-07 04:07 PM Re: Shelling Net Time
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2080
Loc: Tulsa, OK
Are you sure the text file is being opened? Maybe you should add some error checking.
Top
#47643 - 2003-11-07 04:11 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Hello bud

Yes it opens the file fine as it changes the permissions fine, maybe I should try and put a sleep in there. I'll let you knows

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47644 - 2003-11-07 04:17 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
nadgers. Didnt work !!

Anyone got suggestions?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47645 - 2003-11-07 04:19 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Done some error checking and the value it returns after the settime is "0" ha ha great...

HELP ??
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47646 - 2003-11-07 04:20 PM Re: Shelling Net Time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Firstof sall, I'd never give the 'Everyone' group the right to change the systemtime. Restrict this right to your actual users, e.g. 'Domain Users'.

You state that SETTIME does not work. What is the error code returned by SETTIME?

I also agree that Win32Time is the way to go. The 'no time to push it out' is a poor excuse as you now spend time trying to hack your way into making SETTIME work.

Finally, it seems you change the rights on a remote computer but then you try to synchronize the time on your local computer?
_________________________
There are two types of vessels, submarines and targets.

Top
#47647 - 2003-11-07 04:23 PM Re: Shelling Net Time
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Cannot "push" out W32Time?

Try this out -
code:
 ;Time installation
:timeserv
IF @dos >=5 ; Don't do the whole process on Windows 2000/XP
SETTIME @ldomain ; Sync the local clock
RETURN
ELSE
IF exist($systemdrive+'\w32update.ok')
RETURN
ELSE
;Has this been setup?
IF KEYEXIST('HKLM\System\CurrentControlSet\Services\W32Time')=0
;Check for Time files
IF 0=EXIST($windir+'\SYSTEM32\w32time.exe')
COPY @ldrive+'Reskit\TimeService\W32Time\company\Secondary\w32time.exe' $windir+'\SYSTEM32'
ENDIF
IF 0=EXIST($windir+'\w32time.ini')
COPY @ldrive+'Reskit\TimeService\W32Time\company\Secondary\w32time.ini' $windir
ENDIF
;Execute the time service to start automatically
RUN $windir+'\SYSTEM32\w32time.exe -automatic'
;Have to add a small pause to start the service
SLEEP 1
;Execute a Net Start to Start the Service
SHELL '%COMSPEC% /C NET START W32TIME > nul'
SLEEP 1
SHELL '%COMSPEC% /C w32time.exe -update > nul'
COPY $drive+'\system32\config.nt' $systemdrive+'\w32update.ok'
;CLS
RETURN
ELSE
;?'Updating Time Service.. One moment please'
SHELL '%COMSPEC% /C net stop w32time > nul'
SLEEP 1
SHELL '%COMSPEC% /C w32time.exe -remove > nul'
SLEEP 1
SHELL '%COMSPEC% /C w32time.exe -automatic > nul'
SLEEP 1
SHELL '%COMSPEC% /C net start w32time > nul'
SLEEP 1
SHELL '%COMSPEC% /C w32time.exe -update > nul'
COPY $windir+'\system32\config.nt' $systemdrive+'\w32update.ok'
RETURN
ENDIF
ENDIF
RETURN
ENDIF

It is some really old code I have lying around and probably needs to be cleaned up.

Kent

[ 07. November 2003, 16:24: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#47648 - 2003-11-07 04:30 PM Re: Shelling Net Time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
A similar deployment script is here: Time Snchronize
_________________________
There are two types of vessels, submarines and targets.

Top
#47649 - 2003-11-07 04:32 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
I was waiting for your grilling Jens ha ha [Wink]

yes you are correct I will change to domain users.

The error code as explained above returned as 0.

I said as the top i would rather use w32time but my superior (ha ha) has said that the time service will remain the same. (It has to be tested and go through audit etc etc)

quote:

Finally, it seems you change the rights on a remote computer but then you try to synchronize the time on your local computer?

Exactly my orginall point, is it possible to use either settime or net time so it will adjust the time remotley ?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47650 - 2003-11-07 04:34 PM Re: Shelling Net Time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
SETTIME and NET TIME both do the same. They synchronize the date/time of the local computer against a remote time server. Not the other way around!
_________________________
There are two types of vessels, submarines and targets.

Top
#47651 - 2003-11-07 04:40 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Pants.

So im stuffed then?

Is there anything else?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47652 - 2003-11-07 04:46 PM Re: Shelling Net Time
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Why can't you deploy w32time? That is best and easiest way aroudn this. You can have it re-sync several times a day too (especially with large db files, etc.)

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

Top
#47653 - 2003-11-07 04:52 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Alright you twisted my arm, I'll give it a go in out test pc's.

Just out of interest Kent, how do you run your script because it looks like its being run locally?

Do you schedule a task or sumfin?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#47654 - 2003-11-07 04:54 PM Re: Shelling Net Time
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Script runs all from the server as the user running it.

Kent

[ 07. November 2003, 16:54: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#47655 - 2003-11-07 04:55 PM Re: Shelling Net Time
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
I pushed mine out via scheduled task. However, you can also use an admin script to install it on all computers.
_________________________
There are two types of vessels, submarines and targets.

Top
#47656 - 2003-11-07 05:05 PM Re: Shelling Net Time
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Thanks Jens, ill try the admin script.

Once last thing though, I have tried to retreive info on from technet

folloing this link TechNet: W32Time Network Time Service for Windows NT 4.0

But I think Bill got something against me and has moved the link and I cant find where it is.

Does anyone have the necceseary files for w32time and some info?
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
Page 1 of 1 1


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

Who's Online
1 registered (Lonkero) and 175 anonymous users online.
Newest Members
gkustra, emnipetro, Hirze, thequeen, ameliaryan
17642 Registered Users

Generated in 0.04 seconds in which 0.01 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