Link to home
Start Free TrialLog in
Avatar of snarinsky
snarinskyFlag for United States of America

asked on

How to add computer startup script Group Policy using command line

Hi,

I'm trying to make a batch script run at startup.
I know I can do it by using gpedit.msc:
Computer Configuration -> Windows Settings -> Scripts ->Startup and then add the my batch script.

I would like to do the same, but from the command line (actually from another batch script).

Does anyone know how this could be done??

Thanks!
Avatar of Dgleich
Dgleich

Just copy the bat file to this location
        * In Windows XP/2000/2003, the Common Startup value should be set to C:\Documents & Settings\All Users\Start Menu\Programs\Startup.

        * In Windows Vista, the Common Startup value should be set to C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup.

Avatar of snarinsky

ASKER

This won't work. I need to start the script when the computer starts, not when the user logs in.

If I copy the file to C:\Documents & Settings\All Users\Start Menu\Programs\Startup it will run the script only when someone (any user) logs in to Windows.
Hmm what about making special batch file for starting login.scr and add to start your wanted batch file in the same time?
I'm sorry, but I didn't quite get that.

My batch file starts a service (unfortunately that's the only way I can start it). This service has to be started at computer's startup. This computer works as a server, so most likely no user will ever login to this computer directly.

This could be done by using Group Policy editor (gpedit.msc) and placing my script to Startup/Shutdown scripts (not Logon/Logoff scripts as this is another option in gpedit).

I need to do the same, but from the command line...
ASKER CERTIFIED SOLUTION
Avatar of snarinsky
snarinsky
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial