Run a batch file before user logs into Windows 2003 R2?

7,469

Solution 1

Thanks surfasb. Up voted your answer but for some reason it didn't actually work. (user account permissions maybe?). Basically I rebooted the machine and it didn't trigger it.

So I set it up as a proper scheduled task (system scheduler) and set the event as "at startup". Upon the 2nd reboot my batch file kicked off just fine. Didn't investigate this beyond that, but I guess we now have two solutions!

Solution 2

Use GPedit.msc

Go under Computer Management/Windows/Scripts/Startup.

Place your script there.

Note that the script will run under the LOCAL SYSTEM account.

You can use the same method on your 2008R2 instances also.

Share:
7,469

Related videos on Youtube

DeepSpace101
Author by

DeepSpace101

Updated on September 18, 2022

Comments

  • DeepSpace101
    DeepSpace101 over 1 year

    I have an Amazon EC2 machine (Windows Server 2003 R2) where I want to run a script (.bat file) when the Windows Server 2003 R2 machine boots up. This need to run BEFORE any user logs in. Ideally I'd like to extend the same work-around on my Windows Server 2008 R2 instances too - but Windows Server 2003 R2 is critical for me as of now.

    Purely as FYI, the .bat file updates the DDNS records so the EC2 machine doesn't need to consume static IPs.

  • BillP3rd
    BillP3rd over 11 years
    The article explicitly states "but not for batch files."
  • reflexiv
    reflexiv over 11 years
    Wups, thanks for pointing that it. Updated my answer.