A file in "Startup" folder is executed only after login

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
Post Reply
osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

A file in "Startup" folder is executed only after login

Post by osherk » Wed Aug 05, 2015 3:51 pm

Hi,

I have in the installer a script (bat file) that I should put in startup folder because I want it to be run automatically after the machine is rebooting.
The problem is that the script is not running if I don't log in to the machine. I need the installer to execute on server machines that don't need log-ins.
If the user logs in, the script is running automatically with no problems.
How can I solve the issue?

I attached screenshots of my configurations.

Thanks
Attachments
2.png
2.png (99.03 KiB) Viewed 3710 times
1.png
1.png (83.46 KiB) Viewed 3710 times

Daniel
Posts: 8171
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: A file in "Startup" folder is executed only after login

Post by Daniel » Thu Aug 06, 2015 8:35 am

Hello,

Can you please make sure the "Installation Type" filed from "Install Parameters" page is set to "Per-machine only (fails if user is not administrator)" option and see if this helps?

Also, as another solution you can try to configure a scheduled task instead of a custom action.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Philm
Posts: 11
Joined: Fri Feb 13, 2015 1:04 am

Re: A file in "Startup" folder is executed only after login

Post by Philm » Thu Aug 06, 2015 10:13 am

Generally, what you describe as your problem is common windows behaviour.
The startup folder is made for logons.

You have some other possibilities, e.g. I would recommend no. 1.

1.
The most common is, to place, entries in the appropriate registry places:

Google for: "RunOnce"
Key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce

There are rare scenarios, (hardware scans), where I have seen, RunOnce to be executed before reboot, but for 99,9% percent of all cases this is fine.

2.
Working with scheduled tasks is another possibility. It is not as reliable as the registry keys in my eyes.

3.
The most expensive but only perfect solution is to use the "Run" key with an own tool:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run

Place your own program there.
And when your program ist called, you can control on your own, if a reboot was done before calling, perform your actions and control, if everything is fine.
Only if it is, you remove yourself of the RUN key. Details maybe not trivial with UAC, so it may be possible to prepare the last task with a scheduled task before.

osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: A file in "Startup" folder is executed only after login

Post by osherk » Sun Aug 09, 2015 4:57 pm

thanks,

I tried what Philm suggested with the 'RunOnce' and 'Run' but it's not running my script at all. (I need it only when I choose a specific component so I matched it to a feature).
I tried to set a scheduled task but it didn't do it either.

screenshots are attached.
please assist,
thanks
Attachments
2.png
2.png (53.76 KiB) Viewed 3378 times
1.png
1.png (34.96 KiB) Viewed 3378 times

Daniel
Posts: 8171
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: A file in "Startup" folder is executed only after login

Post by Daniel » Mon Aug 10, 2015 3:09 pm

Hello,

Can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate how did you configured the scheduled task?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

osherk
Posts: 41
Joined: Mon Apr 20, 2015 11:55 am

Re: A file in "Startup" folder is executed only after login

Post by osherk » Mon Aug 10, 2015 4:20 pm

Hi Daniel,

I sent it to you twice today. I preferred focusing on the registry so the aip I sent you include registry changes.
Please take a look.

Thanks

Daniel
Posts: 8171
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: A file in "Startup" folder is executed only after login

Post by Daniel » Tue Aug 11, 2015 9:20 am

Hello Osher,

I tested the scenario (run a BAT file at system startup, without logging in) by using a sample BAT file which creates a file and I was able to achieve this by using a scheduled task. Here it is attached a sample project created with version 12.2.1 of Advanced Installer.
sample.zip
(3.1 KiB) Downloaded 128 times
To test the setup, after building it, you should proceed like this:
1. on your test computer create a "C:\Shared" folder and share it through your network so it can be visible from other computers (add "Everyone -> Full Control" permissions so you make sure no permissions issues occurs)
2. install the setup on your test computer and reboot the system (without logging in)
3. from another computer access the "\\testComputerName\Shared" folder and you should see the "testFile.txt" created

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Post Reply