Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login script

Status
Not open for further replies.

nroberts420

Programmer
Jun 24, 2003
27
US
I want a batch file to load when I login to windows. I put the things that I want to load into the autoexec.bat file and it doesn't run it on start up. What should I do so that when a user logs into the computer it runs the programs in the script?
 
Hi,

Windows 2000 doesn't support the autoexec.bat/config.sys files of older versions of windows. YOu can create a batch file and have it run as a user's login script. To do this, go to the user control panel, advanced tab, right click and choose properties of the user that you want to set the script as and switch to the profile tab.
You can put the batch file in the login script field.

It will take effect the next time the user logs in.

John
 
I've written the script and put it in the C:\ directory. When I try to put in "C:\userlogin.bat" in the login script box it says that it is not a valid relative path and if I just put in userlogin.bat it won't run it at login. Also, after I write the script and run it once when I log back in and try to run it it says access denied.
 
Assuming that u r on the network: u have to put this login script on the server and not on the client machine.
 
Put that script file in the startup. So, whenever u login it will start and the the task for u.
 
nroberts420,

Is this something that you want to run when windows starts (ie, for all users). Or is it only for a specific user?

You can add startup script using group policy editor - run gpedit.msc. Computer configuration|Windows Settings|Scripts|Startup - if you use the add button and browse you can find the folder it expects the batch file to be in.
 
I have just looked at the proper location for the script as I can't find a clear answer in the MS documentation. According to this article

the script should be located in:
\%SystemRoot%\SYSVOL\sysvol\DomainName\scripts

This suggests to me that this feature can't be used on standalone machines, because on my standalone 2K box, there is no SYSVOL directory under the %SystemRoot% directory (C:\WINNT).
I know that NT 4 supported local only login scripts because I used this feature many times.
Why did I suggest login scripts rather than batch files in the startup group? Because it is possible to bypass the startup group and any items in it by holding down the shift key at login.
As this can be bypassed, this seems like a retrograde step to me.

If your PC is a standalone box, I would suggest that you try PSingh's idea of putting it in your local startup group (or maybe the global one if needed).

John
 
John - if you use gpedit.msc, location for startup scripts is \WINNT\system32\GroupPolicy\Machine\Scripts\Startup

Logon scripts in \WINNT\system32\GroupPolicy\User\Scripts\Logon

 
I've tried everything in this thread and it still doesn't work. If I put it in the \WINNT\system32\GroupPolicy\User\Scripts\Logon folder it doesn't run it at log in and I can't put it in the startup folder because part of the script is it automatically logs the user off and if its in the startup folder it runs it before logon and shuts down the computer. I don't totally understand that, shouldn't it run the startup programs after logon instead of before? And why doesn't it run the script if I use that gpedit thing?
 
put it in a folder on the C: drive
and give everyone full privilage to it.
then run this command after changing the group policy :

c:/> secedit /refreshpolicy user_policy /enforce
c:/> secedit /refreshpolicy machine_policy /enforce


it should now works .

Mohamed Farid
Know Me No Pain , No Me Know Pain !!!
 
I was reading the thread and thinking if it just meant the local machine then put it in :
C:\Documents and Settings\<username>\Start Menu\Programs\Startup
 
nroberts420

Did you put the script in \WINNT\system32\GroupPolicy\User\Scripts\Logon AND specify the batch file name for the script using gpedit.msc - in User configuration|Windows Settings|Scripts|Logon? (and it didn't run)?

 
Try to create a folder under C:\Program File
let its name &quot; Test &quot;
Thne put the script in this folder , and make it's full control for everyone ..
then from the group policy point to this scrip ..

Mohamed Farid
Know Me No Pain , No Me Know Pain !!!
 
Click Start -> Run
Type gpedit.msc
Expand Windows Settings of User Configuration
Click Scripts (logon/Logoff)
Right Mouse click on the Start Menu, explore
Navigate to the *.cmd / *.bat file, right mouse click on it and copy.
Go back to the Group Policy Editor
Double Click Logon in the right hand pane
Click Show files
Right mouse click in the window and Paste. Close that window
In the GPeditor, click Add, Click Browse, select your file
Click OK
To check it log off then back in
 
Urgent!
Any body know how to launch Internet Explorer automatically upon user network logon in an enterprise environment. (with condition users is using different O/S). I created a login script to launch IE and only can works if IE path is installed in the defaulf directory. My script can not work for some of the machine that IE installed in D: drive. Anybody can advise on this IF and ELSE statement?
Thanks
 
Hi khteoh98,

This will work in every OS since 95:

START <address>

If you just want IE with no web site, start about:blank will do it.

John
 
Copy the batch file you want to run to the clents pc and in their logon script use the start command eg.


(Example logon script)
net use G: \\server\share
start <path of batch file> /max /wait

this will run the batch file in a maximized window and wait for it to finish before windows loads
wait /? for full list of switches
 

Assigning a Logon Script to a User's Profile
1. On the taskbar, click the Start button, point to Settings, and then click Control Panel.
2. Double-click Administrative Tools, and then double-click Computer Management.
3. In the console tree, expand Local Users and Groups, and click Users.
4. Click the user account that you want.
5. Click Action, and then click Properties.
6. Click the Profile tab, and then type the path and file name of the script in Logon script.
7. Click Apply, and then click OK.

Notes
· The default location for local logon scripts is the %Systemroot%\System32\Repl\Imports\Scripts folder. The %Systemroot%\System32\Repl\Imports\Scripts folder is not created on a new installation of Windows. Therefore, the %SystemRoot%\System32\Repl\Imports\Scripts folder must be created and shared out with the share name netlogon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top