Showing posts with label Taskscheduler. Show all posts
Showing posts with label Taskscheduler. Show all posts

Monday, May 04, 2020

Automating Reboots with Task Scheduler

How to automate a reboot or shutdown with task scheduler. To do this you will have to be a user with admin permissions.  You can view the video here

1. Open Task Scheduler



2. Create a new task



3. Fill out the settings in the general tab.  How you want to configure the command and the user account running it.  In this case, I am using a local administrator account, it will run if the user is logged in or not, run with highest privileges, and is configured for server 2019


4.  Create and configure a new trigger


For our new tigger we are setting it to be run on a daily schedule, 5 am every day.  Here you can also disable the task or have it expire after a specific date.


5. Once triggers are set, we can put the code in for setting up the reboot in the actions tab.


Here is where the code goes for executing the reboot

%SystemRoot%\system32\shutdown.exe -r -f -t 1

The task above has set a reboot of the system in one second.  You can read below for other options that can be configured.

Shutdown
%SystemRoot%\system32\shutdown.exe -s -f -t 60 (Shutdown the system in 60 seconds)

Reboot
%SystemRoot%\system32\shutdown.exe -r -f -t 60 (Reboot the system in 60 seconds)

Here is a description of the parameters used above:

-s : The shutdown option.  This will turn the computer off.

-r : The reboot option.  This will reboot the system (turn it off and on again)

-f : forces all applications and services to close and/or stop.

-t : timeout before executing the shutdown or reboot (in seconds).  The default is 20 seconds, but can be changed by adding a number right after it, separated by a space: for example, -t 60 for 60 seconds.

6. Conditions


Setup any additional conditions you want the to configure, such as only running if there is a network connection, if the system has been idle, etc.

7. Settings

Friday, March 03, 2017

Timed Lockscreen on Windows with Taskscheduler

Instead of using a screensaver to activate the lock screen you can use the user32.dll to lock your screen.

Open up Task Scheduler:  I called the task lockscreen.  See below.







On the Trigger I've selected idle.  I've set the task to repeat every 10 minutes.



Actions - Start an program. The path is C:\Windows\System32\rundll32.exe   Add the arguments: user32.dll, LockWorkStation



Conditions.  Start the task only if the computer is idle for how ever many minutes you want.  I selected 1 minute.



 Settings:  Configure any additional settings and be on your way.






Removing Show Recent History and Recently Open Documents from Windows Explorer

How to remove the Recent History and Recently Open Documents from Windows Explorer Using the Registry Editor Press the Windows Key + R, type...