Question

Beginner question - Trying to create a simple logon script that executes when a Windows user logs on and copies a file from one folder to another. The OS is Windows 7.

This link says that logon scripts should go into

%SystemRoot%\System32\Repl\Import\Scripts folder. 

I do not seem to have that folder in my machine. I created it manually and pushed the vbs file in there.

I also opened up computer management and assigned the script to a user. This is a standalone machine and has no network logons.

Code itself is simple and it works when the file is run except it is not getting called during logon.

Is this the right place to put the logon script? Am I doing something wrong.

Eventually I would like to be able to assign the logon script in C# using DirectoryEntry's LogonScript property. Any suggestions in the right direction would be of great help.

Was it helpful?

Solution

Windows has 2 default locatations for local logon scripts:

Both paths don't exist in a default installation and must be created by an administrator.

lusrmgr.msc seems to accept only scripts with paths relative to the default location. For scripts assigned via gpedit.msc you can choose any path you like.

A (local) logon script must be assigned to a profile by one of the abovementioned methods, otherwise it won't be called at logon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top