Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Short answer:</strong> <strong>GPEDIT.MSC</strong> (Start, Run, GPEdit.msc) </p> <p>Windows 2000 and above [1] offer a computer <strong>Startup Scripts</strong> collection in the policy editor:</p> <ul> <li><strong>Computer Settings</strong> -> <strong>Windows Settings</strong> -> <strong>Scripts (Startup/Shutdown)</strong></li> </ul> <p>There's an equivalent <em>logon</em> script area (i.e. after computer startup, when a user logs on) in the User configuration bit.</p> <p><strong>Longer:</strong></p> <p>GPEDIT.MSC is the Group Policy editing console, and runs against the local computer's Group Policy store when it's used directly, so it's useful for setting local-only parameters. When using Active Directory, the same interface is used to edit forest-hosted <em>group policy objects</em> (GPOs), so the same settings are available across a bunch of machines.</p> <p>The computer startup scripts run in the <em>computer context</em>, i.e. LocalSystem, as you noted, so they often can't access network drives which require a certain user or group membership to work, and so on. When computers access the network, they generally (with exceptions) use their MACHINENAME$ account.</p> <p>A <em>startup script</em> is a quick and easy way of getting a process running when the machine boots. </p> <p>The computer startup process will be affected by the time it takes to run the program, though, so you might want to ensure you call it with the START command from a batch file, or specifying not to wait for the executable to complete in whatever script language you use. (the key point there is: run the script <em>asynchronously</em> unless it's critical, or doesn't need to be run asynchronously cos it will always take <em>no time</em> at all. Long boots = unhappy users).</p> <p>Using a Win32 Service is an alternative option - you can use the <strong>SRVANY</strong> utility from the Resource Kit to "service-ify" pretty much any executable. VS.Net 2002 and later also let you build a managed service directly.</p> <p>And <strong>Task Scheduler</strong> gets <em>much</em> more capable as of Vista/2008, able to run scripts at startup, on idle, and/or when Event Logs are generated or certain other conditions are met: it's pretty cool! Scheduled Tasks has the possible advantage of being able to specify the user account under which the task runs, if that's important to you.</p> <p>Caveat Scriptor: <a href="http://support.microsoft.com/kb/256320" rel="nofollow noreferrer">http://support.microsoft.com/kb/256320</a></p> <p>Run Startup Scripts Asynchronously: <a href="http://msdn.microsoft.com/en-us/library/ms811602.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms811602.aspx</a></p> <p>Vista Task Scheduler (what's new): <a href="http://technet.microsoft.com/en-us/appcompat/aa906020.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/appcompat/aa906020.aspx</a></p> <p>[1] Windows XP, 2003, Vista/2008, Windows 7/2008R2, Windows 8/2012, Windows 8.1/2012R2, Windows 10/Windows Server 2016. Everything. But NT4 didn't!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload