Execute task on Windows startup/shutdown with custom message - windows

I already know a task can be executed on startup or shutdown by defining the path to the desired script in the group policy editor (gpedit.msc) under
Computer Configuration --> Windows settings --> Scripts (Startup/Shutdown).
But how is it possible to show a custom progress message on the Windows startup respectively shutdown screen during task execution? For example Windows Update shows the following message when installing updates
Configuring Windows updates n% complete.
Do not turn off your computer.
Any help is appreciated.

Related

Task scheduler runs console app task only for the first time

I created console app in .Net technology. App works fine when I trigger it by click on exe setup (console shows up for about 5-6 min and that's how it should work), so I put it into Task Scheduler(Windows Server 2022) as a Task with settings:
1.General: Administrator, Run only when user is logged on.
2.Triggers: one time at xxx after trigerred repeat every 15 min, enabled.
3.Actions: Start a program with start in optional parameter (where exe file is).
4.Conditions: none checked.
5.Settings: allow on demand, do not start a new instance.
When I run it from windows explorer task runs properly for the first time. On the next start it stops running. Nothing happens. No errors/unusual results in history. Status changes to Running for 2-3 sec and get back to Ready. if I run it again from the explorer level, task runs properly again, but only for the first time.
What I've tried:
1.Change user (system, local service, network service, administrator).
2.Run logged in and not logged in.
3.Highest priviliges on/off.
4.Every kind of trigger time option.
5.With and without optional start in.
6.Different locations(desktop, C:/, other).
7.Run as Admin in .exe properties.
8.Every checkbox on/off in settings.
Anyone faced this issue? Thanks in advance.

Windows 10 Task Scheduler tasks don't even try to run

I am trying to get a task in windows scheduler to run every 10 mins.
In the following image there are two blue lines, this is only one task but I have screenshot them at different times after refreshing the page.
As you can see in the image Task Scheduler, on the bottom blue line under last run time it says 3:37pm and next run time is 5:02pm. then on the top blue line I have a screenshot the same task after 5:02pm, it hasn't updated the last run time but it has pushed the next run time forward 10 mins.
If I right mouse click on the task and manually run it, it works. Its just the timer functionality of task scheduler that isn't working, I'm guessing i have misconfigured it somehow.
These are the options I have set, everything else is on it's default value.
Trigger
Daily
Recur every 1 day
Start today
Repeat task every 10 mins
for a duration of indefinitely
Expire tomorrow
Enabled
Conditions
Do not Start task only on AC
Wake the computer to start the task
Settings
Run task as soon as possible after scheduled start is missed
My question, What do I need to change to make this actually run every 10 mins.
Evidence of me searching before posting.
Task Scheduler Not Running Batch File I don't use a start path.
Batch file runs manually but not through Windows 10 Task Scheduler I'm not running over the network but I did elevate privs, even though my program doesn't write any files.
Running PowerShell in Task Scheduler Doesn't mention timer functionality only action functionality.
Task Scheduler failed to start. Additional Data: Error Value: 2147943726 I'm not trying to run while I'm logged out and I'm not getting this error message.
I found that when I changed the 'interval' from 'indefinitely' to '1 day', it started to works

2016 Task Scheduler Only Runs the first action in the list

I have a simple Task Schedule job that runs a program 6 times, sending to it a different Argument each time.
This has been working well for some years, but on 2016 Server it only runs the first action and then it stops.
Any ideas of a fix? I have looked on google for all fixes etc, but they haven't worked and seem to be for 2017 and back
Based on my past experience, this behavior could caused by one of the following:
If your task targets a batch file of an executable file, try to check Windows Task Manager for that file running under "Processes" tab. Select each of your target batch/exe then End Process button. This may have caused by a seemed-to-stuck process but still on "Running" status.
On Task Scheduler, check for your task's "Last Run Result". This could be having code other than 0x0 (which is the successful run). If so, check for details under "History" tab below this pane.

Launch a program when computer is connected to internet

I'm using windows 7. I wrote an application to fetch contents from a webpage. I want that application/ script to be executed automatically once the computer is connected to the internet.
I tried Task scheduler, but I'm unable to find an event when computer is connected to internet.
Thanks
Found answer. Thought it would help someone so sharing.
To trigger an event on connecting to the network:
Open the Task Scheduler. Programs > Accessories > System Tools.
create a new task by clicking Create Task in the Actions panel on the right side.
add task
Give the task a name.
On the Triggers tab, click New... and select On an Event from the dropdown box.
dropdown trigger
Log: Microsoft-Windows-NetworkProfile/Operational
Source: NetworkProfile
Event ID: 10000
Click OK, then go to the Conditions tab.
Check the box for Start only if the following network connection is available and choose the network you want to run the script with
Under the Actions tab, click New... and select Start a program. Enter the location of the script file you want to run, then click OK.
Set any other task settings you want to, then click OK.
Setting an event for when you disconnect from the network:
Follow steps 2-4 above
Use the following event trigger settings:
Log: Microsoft-Windows-NetworkProfile/Operational
Source: NetworkProfile
Event ID: 10001`
Skip steps 6-7, as you will no longer be attached to any network at all. This event will therefore run any time you disconnect from any network.
Follow steps 8-9 again

How to show finishing form in Setup Wizard as if setup was interrupted?

I am creating a setup wizard project in Visual Studio 2010. During the installation I am running a PowerShell script in a custom action and depending on its result I need to show a successful or interrupted/failed finishing form. How can I do that?
PS The script is running in a silent mode if it matters.
Thanks!
Standard setup wizard doesn't support statuses. The only way to interrupt setup programmatically is to throw exception which causes a notification, what is not acceptable in my case.

Resources