Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Running a process in Windows 2000 Before Logon

I would like to run a command in Windows 2000 to inform a console that the PC has rebooted. I only want to do this once.

I tried adding a key to the runonce key in the registry for "NET SEND CONSOLE Rebooted". This works but only when someone signs onto the PC. How can I do this at startup but before the user signs on.

Urgent response requested, hence the high points.
0
wilsontony
Asked:
wilsontony
  • 3
  • 3
  • 3
  • +3
1 Solution
 
makerpCommented:
the best way to do this is write a service; services get started when the machine boots up windows. they are executed before logon.

you will need to write one
regsiter it
set it to start automatically....

can you program....
0
 
jhanceCommented:
As already noted, the only things that run WITHOUT an interactive logon are SERVICES.  This is what they are for.

Let me suggest Kevin Miller's book on the subject, "Windows NT Services" published by WROX.
0
 
wilsontonyAuthor Commented:
I only want to run this ONCE. If I create a service it will run it everytime. I do not want to make too drastic a change to the PCs.

Thanks for the comments.
0
[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

 
makerpCommented:
just have your service use the system("NET SEND machine message") then exit. that way it will execute once when the system is started then it will die.

>>I do not want to make too drastic a change to the PCs.

then if you consider registering a service drastic then go tell your manager it is not possible to do what he/she wants.... then maybe collect your coat, ask for your p45 to be sent straight to you home address and go home
0
 
wilsontonyAuthor Commented:
If I could make the service unregister itself as soon as it runs the first time then this may be acceptable.

I would be doing this remotely via WMI so ideally the solution would be as simple as possible. I thought someone may have some cute way of doing this and that is the reason I posted this question.

As an MCSE/2000 with over 10 years experience, please spare me the P45 quips!
0
 
jhanceCommented:
I HARDLY consider a SERVICE to be "drastic".  Under Windows NT/2000/XP a service is simply an application that runs without an interactive user.

There is no requirement that a service continue running.  It can simply start, do its thing, and then terminate.

I'll just 2nd makerp's sentiment that if you consider this "drastic" that you are unqualified to do what you as being asked to do.

Once again, I refer you to Miller's book.  It will help you learn something new, help you solve this problem, and make you a better and potentially more valuable employee.
0
 
makerpCommented:
>>If I could make the service unregister itself as soon as it runs the first time then this may be acceptable.

why would you want to do that; then youll have to re-register it before each time you were going to re-boot. do you only want this to run ONLY ONCE or every time it re-boots. if ONLY ONCE then may i suggest that you phone call the effected people, this will probably be cheaper...... if you want it to run when ever the machine starts then you need to regsiter it ONCE on the PC and then forget about it.
0
 
CrazyOneCommented:
Well you could use the task Scheduler and schedule it to run at system startup. Then put a batch file in the RunOnce key to delete the scheduled task

DEL C:\WINNT\Tasks\TheTask.job

Of couse I am sure you know you need to include a User and the Password for the user in the sheduled task. In this case one with admin privleges.


The Crazy One
0
 
CrazyOneCommented:
As far as running it as a service you could let the service run and then in the RunOne put in a batch file to run this command

TheDrive\TheFolder\TheService /uninstall
0
 
bonzaiCommented:
i would do this via group policy Startup script

(mmc - add remove snap-in - group policy)

There, browse to "local Computer Policy - Windows sttings - Scripts(Startup/Shutdown)

add a batchfile with about the following content:

--------------
net send %console% Rebooted
del thisbatchfile.bat
--------------



0
 
bonzaiCommented:
i would do this via group policy Startup script

(mmc - add remove snap-in - group policy)

There, browse to "local Computer Policy - Windows sttings - Scripts(Startup/Shutdown)

add a batchfile with about the following content:

--------------
net send %console% Rebooted
del thisbatchfile.bat
--------------



0
 
smadarasCommented:
Bonzai has exactly the right answer. Forget about that Service nonsense.
0
 
bonzaiCommented:
huh... thank you smadaras... feeling verry embarrassed :-)
0
 
smadarasCommented:
The one thing I would add to bonzai's response is that I would use a vbscript, which sets and then checks a reg key, instead of deleting the batch file. With that scenario you can put the startup script in any GPO, site, domain or OU.
0
 
wilsontonyAuthor Commented:
Thanks for all the comments guys. You were all really helpful
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 3
  • 3
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now