Page 1 of 1 1
Topic Options
#99122 - 2003-03-06 12:36 AM Using the "Run" registry key.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Microsoft's knowledge base article are contradictory on this, so a little help please.

I have a WTS farm which I am writing a reboot process for. When the machine come up, I want to clean up the profile and temporary directories. So far so good.

The problem is that there are two views depending on which article you read. One article states that both the "Run" keys are acted upon only after someone logs on, whereas another article implies that "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" is executed when the server starts.

Does anyone have the definitve anser to this?

Top
#99123 - 2003-03-06 12:41 AM Re: Using the "Run" registry key.
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
You mean RUN, RUNONCE and RUNONCEEX ?

Or did I miss something obvious ?
Are there 2 RUN keys in WTS ?
Maybe yes as I have not much experience in WTS and have nothing here to research [Frown]
_________________________



Top
#99124 - 2003-03-05 01:06 PM Re: Using the "Run" registry key.
Richard H. Administrator Offline
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
#99125 - 2003-03-05 01:09 PM Re: Using the "Run" registry key.
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Think (intuitively) that no other things than Services or 'Devices' 'run' without someone logs in interactively .... flaming suite put on [Roll Eyes]
_________________________



Top
#99126 - 2003-03-05 03:11 PM Re: Using the "Run" registry key.
Radimus Moderator Offline
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99127 - 2003-03-05 03:31 PM Re: Using the "Run" registry key.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Ok,

These are WTS (NT4.0) servers, so how do I schedule a task for startup?

I can't seem to find the /etc/rc3.d directory.

Top
#99128 - 2003-03-05 05:01 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Use the Task Scheduler which has an option to run scripts at startup.
_________________________
There are two types of vessels, submarines and targets.

Top
#99129 - 2003-03-05 05:03 PM Re: Using the "Run" registry key.
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
You aren't looking hard enough! [Big Grin] (or maybe we aren't coding enough to implement the RC stuff! Hmmm...)

If you run the later version of the Task Scheduler, you can configure a task to run "At Startup" Upgrading IE to 5.0 or higher and installing the "Offline Browsing Pack" is one way to install the updated scheduler. There may be others, but without more caffienated beverages, I can' think of them.

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

Top
#99130 - 2003-03-05 05:04 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I was first! [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#99131 - 2003-03-05 05:09 PM Re: Using the "Run" registry key.
Richard H. Administrator Offline
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
#99132 - 2003-03-05 05:12 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Nope, Task Scheduler is a new/advanced version. It is included in Windows 2000/XP and can be installed with the 'Offline Browser Pack' for IE5+ under Windows NT. Check out the ScheduleTask() UDF or Glenn's tsScheduler() UDF collection.

AT is just the CLI for the scheduler service.
_________________________
There are two types of vessels, submarines and targets.

Top
#99133 - 2003-03-06 10:59 AM Re: Using the "Run" registry key.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Good info.

Before I start going down the road to perdition that is installing software on WTS, do you know at which stage the task will run?

Specifically, is the network fully available so that the task can be run from the NETLOGON share?

[EDIT]
I'm running XP on my workstation, Task Scheduler (GUI) is available but no "jt.exe" CLI interface - is this an optional part of the installation?
[/EDIT]

[ 06. March 2003, 11:13: Message edited by: Richard H. ]

Top
#99134 - 2003-03-06 05:07 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please see the ScheduleTask() UDF for the souce of the JT.EXE, it's an optional add-on from Microsoft.
_________________________
There are two types of vessels, submarines and targets.

Top
#99135 - 2003-03-06 05:17 PM Re: Using the "Run" registry key.
Richard H. Administrator Offline
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
#99136 - 2003-03-06 05:24 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I believe JT.EXE works under Windows NT 4.0 as I am using it under Windows NT 4.0 Server. However, you can alwasy schedule tasks remotely from a Windows 2000 computer to a Windows NT 4.0 computer.

Just don't believe everything that Microsoft says/writes. [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#99137 - 2003-03-07 06:02 AM Re: Using the "Run" registry key.
Glenn Barnas Administrator Offline
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! \:D

Top
#99138 - 2003-03-07 10:41 AM Re: Using the "Run" registry key.
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I'm not looking forward to upgrading the farm, but it looks like my only solution.

Many thanks for all the info.

Top
#99139 - 2003-03-07 04:24 PM Re: Using the "Run" registry key.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Glenn: Post the script in the COM Forum.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 400 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.072 seconds in which 0.025 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