#99124 - 2003-03-05 01:06 PM
Re: Using the "Run" registry key.
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Directly from the horses mouth: quote: Run and RunOnce Registry Keys
Run and RunOnce registry keys cause programs to run each time that a user logs on. The data value for a key is a command line. Register programs to run by adding entries of the form description-string=commandline. You can write multiple entries under a key. If more than one program is registered under any particular key, the order in which those programs run is indeterminate.
Windows NT 4.0, Windows 2000, Windows XP and Windows Server 2003 family registry includes the following four keys:
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
Windows 95/98/ME registry includes the following seven keys:
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce
- HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup
By default, the value of a RunOnce key is deleted before the command line is run. You can prefix a RunOnce value name with an exclamation point (!) to defer deletion of the value until after the command runs. Without the exclamation point prefix, if the RunOnce operation fails the associated program will not be asked to run the next time you start the computer. By default, these keys are ignored when the computer is started in Safe Mode. Starting with Windows NT 4.0 SP3, the value name of RunOnce keys can be prefixed with an asterisk (*) to force the program to run even in Safe mode.
A program run from any of these keys should not write to the key during its execution because this will interfere with the execution of other programs registered under the key. Applications should use the RunOnce or RunOnceServices keys only for transient conditions, such as to complete application setup. An application must not continually recreate entries under RunOnce or RunOnceServices because this will interfere with Windows Setup.
Run and RunOnce keys are run each time a new user logs in. RunServices and RunServicesOnce are run in the background when the logon dialog box first appears or at this stage of the boot process if there is no logon. These keys are for background services such as remote registry service and are run only once per boot. The Setup key is run only by Setup's first-boot activities, or after you use the Add/Remove Programs Wizard. This key displays the progress dialog box as the keys are run one at a time. For the Setup key, the name of the value is the name that is displayed in the dialog box.
This is contradicted by another article (which of course I can't find again!) which implies that the HKLM Run key is used at boot time.
Now, I may be able to get away with the RunOnce key if that is executed during start-up, but I want it to always run, even if I have not scheduled it (hence the requirement for the Run key). This way the cleanup will happen if the restart is manually actioned, and I can mail myself an alert if the restart is unexpected.
|
|
Top
|
|
|
|
#99126 - 2003-03-05 03:11 PM
Re: Using the "Run" registry key.
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
anything in the RUN keys are run at logon... similar to items in the starup groups.
If you want something to run at bootup, you would want either a task scheduled or a GPO for machine startup
|
|
Top
|
|
|
|
#99131 - 2003-03-05 05:09 PM
Re: Using the "Run" registry key.
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Argh. Gonna have to 'fess to ignorance.
Is the task scheduler the same as good 'ole "AT", or is this a new beast?
Only "at /?" just gives me:
code:
G:\dev >at /? The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command.
AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command"
\\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. id Is an identification number assigned to a scheduled command. /delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. /yes Used with cancel all jobs command when no further confirmation is desired. time Specifies the time when command is to run. /interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs. /every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. /next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed. "command" Is the Windows NT command, or batch program to be run.
Don't make me use the GUI interface - I promise I'll be good.
|
|
Top
|
|
|
|
#99135 - 2003-03-06 05:17 PM
Re: Using the "Run" registry key.
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
quote: Requires the file JT.EXE, which is part of the Microsoft Windows 2000 Resource Kit Supplement.
Ahem. Your honour, I refer m'learned colleague to my previous statement: quote: These are WTS (NT4.0) servers, so how do I schedule a task for startup?
So, does the W2K jt.exe run on NT4.0, or am I barking?
Up the wrong tree, that is.
|
|
Top
|
|
|
|
#99137 - 2003-03-07 06:02 AM
Re: Using the "Run" registry key.
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
|
JT is part of the W2K resource kit, but can manipulate Windows Task Scheduler service on any NT system where it is running.
I have installed JT on my local workstation (NJ) along with the tsControl UDF and a couple of scripts I have that use it, and have successfully configured tasks on NT and 2K servers throughout our organization, including sites in TX, OH, and MN.
As I mentioned earlier, Windows Task Scheduler has been a part of the IE enhancements since 4.1 or 5.0. As long as you have a later version of IE, it should work. The old version had a service name of "Schedule" while the new one is called "Task Scheduler". Just check your service list.
You should have no issues with T/S as long as the scheduler service is up to date.
I now have a KixForms Task Scheduler GUI tool that works with the tsControl.udf if anyone is interested. Lets you connect to a server and display, add, edit, & delete tasks with up to 10 triggers apiece. Also provides the ability to change the task's credentials without editing the task settings. I'd be glad to email it to anyone that wants to give it a work-over.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1183 anonymous users online.
|
|
|