Windows 7 Home: how to configure a logon script

You're right, this MMC snap-in is disabled unless you have at least Windows 7 (or Vista) Professional.

You should be able to configure user properties using the net user command:

net user UserName /scriptpath:logon.bat

The script location:

Local logon scripts must be stored in a shared folder — or subfolders of the shared folder — named Netlogon. If this folder does not exist by default, you must create it. To specify a logon script that is stored in a subfolder of the Netlogon folder, precede the file name with the relative path to that folder. For example, to assign the Startup.bat logon script that is stored in \ComputerName\Netlogon\FolderName to a local user, in Logon script type FolderName\Startup.bat


Summary for what I did to resolve this issue:

  • I've created a script in C:\Windows\System32\repl\import\scripts\<username>.bat
  • invoked net user <username> /scriptpath:<username>.bat

Because Windows 7 Home did not wait until this script had been finished and continued to load other applications, I also needed to create a DWORD entry named RunLogonScriptSync at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon in the registry setting the value to 1.


The accepted answer is the way to do it, if you want your script running early in the system startup, or need the script to run synchronously - that is, the normal logon process will continue only after your script has completed (watch out, it can slow down logon, use it only if you need it).

Note: I'm not sure if the scripts mentioned above can be an .exe file or not, but in the method I will describe any executable can be used.

Another way to do, which has some extra flexibility, is using the Task Scheduler. From the start menu, type Task Scheduler and run it (or run taskschd.msc from Run dialog or a shell). Select Task Scheduler Library in the tree view. If you want, you can create a special subfolder for your programs, but this is not necessary. Click Create Basic Task... (wizard) or Create Task... in the Actions panel on the right side.

I will explain how to use Create Task....

  • In the General tab, fill out a descriptive name and, optionally, a description for your task.
  • In the Triggers tab, click New..., set Begin the task to At log on. Check the Specific user combobox, make sure your username is selected (you can use Any user if you want the program to run when any user logs in). If you don't want your script to slow down the log in process, you can choose to run it after a delay - click Delay task for checkbox and type in the time (e.g. 30 seconds). Click ok to create the trigger.
  • In the Actions tab, click New..., choose your program (or script) using Browse... or type in the full path into Program\program. If the program is in your %Path%, you can just use program. You may specify any arguments to pass to the program in Add arguments. You may specify the working directory for the program in Start in. You can use any type of script the local computer supports; if a script type is not registered with Windows, you can still run it by specifying the script interpreter as the program. E.g. use C:\path\to\python.exe as the program, and C:\path\to\script.py some_arguments as arguments. Click ok to create the action.
  • In the Conditions tab, you probably want to uncheck the Start the task only if the computer is on AC power.
  • In the Settings tab, there is no need to change anything.

Click ok to create the scheduled task. If you want to edit it later, just select Task Scheduler Library in the tree view, find your task in the list (at top part of the window) and double-click the task.

See the Task Scheduler reference for more information.