?
Solved

how to run a command once at system start

Posted on 2006-05-12
14
Medium Priority
?
410 Views
Last Modified: 2012-05-05
I'd like to run the following command at system start one time only "wuauclt /detectnow"

I've tried using the following registry modification and it appears to only execute after a user logs onto the workstation.

"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"updatewsus"="wuauclt /detectnow"

I'd like this to take place at system start immediately after a programmed reboot. I'd like for the command to execute before a user logon occurs. in other words i don't want to have to depend on a user logging on for the command to execute.
0
Comment
Question by:raygraham
11 Comments
 
LVL 32

Accepted Solution

by:
r-k earned 500 total points
ID: 16671025
Put your command in a batch file, the use Control Panel -> Scheduled tasks -> Add Scheduled tasks

and select your batch file and schedule it to start "When my computer starts"
0
 
LVL 6

Assisted Solution

by:junglerover77
junglerover77 earned 500 total points
ID: 16671376
I don't know r-k's suggestion is right or not, but in my opinion, only Services can execute before user login.

Create a VB application and register it as a service of your computer with NTSVC.OCX, and shell your command in the application.

Refrence:
http://support.microsoft.com/kb/175948/EN-US/
0
 
LVL 32

Assisted Solution

by:jhance
jhance earned 500 total points
ID: 16671580
r-k's suggestion is right on.  The scheduler service, which runs Scheduled Tasks, will run at the scheduled time regardless of whether a user is logged in or not.  The "When my computer starts" setting for the scheduler will run the task when the computer starts as you want.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:rfportilla
ID: 16672493
Sorry guys, but all that is cheesy.  Try registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Add new String Value and give it a name.  Set value to:

"wuauclt" /detectnow

Let me know if there are any problems.
0
 
LVL 6

Expert Comment

by:junglerover77
ID: 16672501
Hi rfportilla, before you say something, please try it on your own computer first, OK?

Try to be responsible.

Regards,
Jungle
0
 
LVL 9

Assisted Solution

by:rfportilla
rfportilla earned 500 total points
ID: 16672524
Sorry, just caught on to "before a user logon occurs."  Use group policy.  This is the normal way to do this.  There is a specific place for startup scripts.  Create a script and open the

Local Computer Policy -> Computer Configuration -> Windows Settings -> Scripts

Double-click and add your script.

Additional bedtime reading:
http://www.microsoft.com/technet/scriptcenter/topics/gp/extension1.mspx
 
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 16672527
I didn't realize I was being irresponsible.  This is something I've done many times.
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 16672548
One more thing.  If you are running a domain, you can set up group policy to enforce the startup script on all machines without having to create a task on each machine.  Let me know if you need help with any of the steps.
0
 
LVL 1

Expert Comment

by:rbvoigt
ID: 16672682
logon script will work at the beginning of a user logon, but the OP seems to want something to run without a user logging in.  I use FireDaemon for this myself, to run a LazyMirror registry backup after each successful startup.
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 16672718
I am specifying a startup script, not a logon script.  They are different.
0
 
LVL 9

Expert Comment

by:rfportilla
ID: 16829977
I think I deserve a split on this.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question