Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3557
  • Last Modified:

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!
0
snarinsky
Asked:
snarinsky
  • 3
  • 2
1 Solution
 
DgleichCommented:
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.

0
 
snarinskyAuthor Commented:
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.
0
 
DgleichCommented:
Hmm what about making special batch file for starting login.scr and add to start your wanted batch file in the same time?
0
 
snarinskyAuthor Commented:
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...
0
 
snarinskyAuthor Commented:
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now