Tech

How to: Use Windows 10 in automatic mode


The task planning enables the time-controlled start of maintenance programs. Windows has already set up some tasks by default. You can also optimize the automatic start with your own tools.

Even if you are not using the PC yourself, Windows is busy working in the background. Even with a fresh standard installation, numerous entries are defined in the task scheduler that Windows should do when it starts up or at a specific time. The system searches for and installs, for example, Windows updates and fresh signatures for the Windows Defender virus scanner. In addition, the hard drive is checked, defragmented and cleaned up and the file system is synchronized with Microsoft OneDrive.

Task planning is open to everyone. Applications can register here, for example to check for updates or to carry out maintenance work. Task planning can also be used for your own purposes. This is particularly useful for backup functions, clean-up work or regular hard disk defragmentation.

1. First steps in Windows task planning

Planning center: In the task planning, the entries are organized in a tree structure. Here you can view and configure the tasks and also start them manually for tests.

Enlarge

Planning center: In the task planning, the entries are organized in a tree structure. Here you can view and configure the tasks and also start them manually for tests.

Start the task planning by searching in the start menu. Or you can use the key combination Win-R to type

taskschd.msc

and confirm with “OK”. The three-part window shows a tree structure on the left. The first element is called the “Task Scheduler Library”. If you click on it, you will see a list of the tasks it contains in the middle of the window. As a rule, entries from third-party providers can be found here that were created during the installation or configuration of the software.

The right part of the window, titled “Actions”, is divided into two parts. The upper area refers to the current folder. Functions can be found here, for example to create a new task. The lower area labeled “Selected Item” applies to the currently selected task. By clicking on “Run” you start this manually regardless of the schedule, with “End” you stop a running task. A task can also be deactivated or deleted. Some of these functions are also contained in the context menu of an entry. The middle area is horizontally divided in two. If you click on an entry, the lower area shows you information on several tabs.

“General”:

This usually contains a more detailed description of the function and which user account is used to perform a task.

“Trigger”:

Here you can find out which triggers are available for the start. For example, “When a user logs on” or a time. Several triggers can also be defined.

“Actions”:

The program or script that is started is entered here.

“Conditions”:

This tab shows options that can restrict the start, such as “Only start the task if the computer is running on the network”.

“Settings”:

The behavior of tasks can be restricted by options. If, for example, “Execute tasks as soon as possible after a missed start” is activated, the task will start even if the computer was not switched on at the specified time.

“History (deactivated)”:

If the history is to be logged, click under “Actions” on “Activate history for all tasks”. However, this should only be used to locate errors when necessary and for a short time, as recording the log can put a heavy load on the system.

If you want to change the configuration of a task, go to “Properties” in the context menu. The window displays the same tabs as the middle area of ​​the main window. For example, on the “Trigger” tab, you can select an entry and simply click “Edit” to change the schedule or event.

See also:

The 35 Best CMD Tricks for Windows

2. Preparations for testing your own tasks

Script as a task: Batch files can be started using Cmd.exe via the task scheduler. Our example shows a batch script that writes the date and time to a log file.

Enlarge

Script as a task: Batch files can be started using Cmd.exe via the task scheduler. Our example shows a batch script that writes the date and time to a log file.

The task planning can start any applications and batch files via Cmd.exe and Powershell scripts via Powershell.exe.

For a first test, create a batch file with the name “Task-Test.bat”. The easiest way to create a batch file is in Windows Explorer – for example in the “Documents” folder – by right-clicking on “New -> Text Document” and then renaming the file. If you have not already done so, put a check mark in front of “Filename extensions” on the “View” tab. Otherwise the renaming will not work correctly and the file “Task Test.bat.txt” will be created, which cannot be executed.

Open the BAT file via the context menu item “Edit” in the editor and insert this line:

echo Aufgabe erledigt >> „%USERPROFILE%DocumentsAufgaben.log“ 

Save the file and start it with a double click. In the “Documents” folder you will now find the “Tasks.log” file with the content “Task completed”, which can be opened by double-clicking in the editor.

The redirection sign “>>” causes new lines to be appended. Only “>” would delete the previous content of the log file. “% USERPROFILE%” is a variable that points to your profile directory. Please note that the folder names actually available must be used in batch files – in our example, “Documents” instead of “Documents”.

A more detailed version of the test file can be found in the

PC-WELT Windows Service Center
in the “Tools Scripts” folder (see also figure). The batch file also writes the date and time in the log file so that the execution time can be determined.

You can use the batch file later as a basis for your own tasks. Simply put one program start per line that you would like to automate via the task planning.

Tip:

Use as an editor for batch files or Powershell scripts

Notepad ++
. Thanks to syntax highlighting, the program provides a better overview and can open several text files in tabs at the same time.

3. Create and schedule a new task

Use wizards for tasks:

Enlarge

Use wizards for tasks: “Create simple task” only asks for the most necessary information. You can add what is missing later in the properties of a task.

Tasks you have created yourself can be stored in any folder in the task planning or directly in the “task planning library”. For greater clarity, it is advisable to create a folder – for example with the name “MyTasks” – by clicking on “New folder”.

Step 1:

Click on the desired folder and under “Actions” select the entry “Create simple task”. Behind this is an assistant that guides you through the necessary steps.

Step 2:

Enter a meaningful name and description. Click on Continue”.

Step 3:

Set the trigger, for example Daily, and then click Next.

Step 4:

Set the date and time for the first start. After “Repeat all:” leave the “1” for the daily execution. Otherwise enter the desired value. Click on Continue”.

Step 5:

Leave the option “Start program”. There are also the options “Send e-mail” and “Show message”, both of which are marked with “(obsolete)”. In future Windows versions, these options may therefore be omitted. Click on Continue”.

Step 6:

Enter the name of the program or script. In the case of executable files, the name of the desired file and path is sufficient. After “Add arguments (optional)” you can now enter any required parameters. “Start in (optional)” includes the path to the working directory, which is necessary for some programs.

If you want to start a batch file, type cmd.exe after “Program / Script”. This is the command interpreter for batch files. For our example, after “Add arguments (optional)” is the line:

/c start „Aufgaben-Test“ /MIN C: Users[User]DocumentsAufgaben-Test.bat ^& exit 

The “/ C” option causes the command to be executed with its own command interpreter, which is then automatically terminated. The command executed is “start”, which allows a program to be executed in its own window. The information behind it is the optional window title. With “/ MIN” the window is minimized.

This is followed by the full path to the BAT file. Adjust the path for your configuration. The placeholder “[User]Please replace “with your username. “^ & Exit” at the end of the line ensures that the command interpreter window that was started first closes.

Step 7:

Click on Continue”. If you want to edit the configuration, check the box “When you click on ‘Finish’, open the properties for this task”. Then click on “Finish”.

Start the new task manually via the context menu item “Execute”. Take a look at the contents of the “% USER PROFILE% Documents Tasks.log” file, which now contains another line.

4. Define user accounts and rights for tasks

Edit action: For a batch file, enter cmd.exe under “Program / Script”. All other information goes after

Enlarge

Edit action: For a batch file, enter cmd.exe under “Program / Script”. All other information goes after “Add arguments (optional)”.

By default, a task is executed with the user account under which it was created. However, the task planning runs under the “System” user account. For this reason, you cannot use environment variables such as “% USERPROFILE%” in the task planning, but you can use them in the batch file.

User accounts without administrative rights can also use the task scheduler. However, only tasks that do not require elevated rights can then be configured.

If you work with a system administrator account, you can check the “Execute with the highest privileges” checkbox in the properties of a task on the “General” tab. This is necessary when you create backups of files that you would otherwise not have access to or start programs with higher rights. If the access rights are insufficient, click on the “General” tab on “Change user or group”. Type in System, click Check Names, then click OK. Save the changed task by clicking on “OK”. This also automatically activates the “Execute independently of user login” option.

Windows 10:

The most important hotkeys & shortcuts

5. Use Powershell scripts in task planning

Backup task: A short Powershell script is sufficient to regularly back up personal files according to a schedule and to save space as a ZIP file.

Enlarge

Backup task: A short Powershell script is sufficient to regularly back up personal files according to a schedule and to save space as a ZIP file.

Powershell scripts offer more options than batch files. In the folder “Tools Scripts WindowsPowerShell” from

PC-WELT Windows Service Center
you will find two examples of simple backup scripts.

“ZIPCompressFolder.ps1” uses the integrated ZIP function from Powershell. “7zCompressFolder.ps1” uses 7-Zip, which improves compression and enables archives to be password-protected. We only describe the installation of the first script here; for the second, proceed accordingly. You will find comments on the special features in the script file. Copy the folder “WindowsPower Shell” into the folder “Documents” in your user profile. Start a Powershell via Win-X and “Windows PowerShell”.

Run these two command lines:

cd $env:USERPROFILEDocumentsWindowsPowerShell
powershell -ExecutionPolicy Bypass ./ZipCompressFolder.ps1 [Quelle] [Ziel]

The placeholders “[Quelle]Please replace “with the folder you want to back up. You can have a path with variables like

$env:USERPROFILEDocuments

use. For “[Ziel]“Enter the target directory, which is optimally placed on a second hard drive or a USB drive. The name of the ZIP file in the target folder is the current date and time.

Create task for the script:

Proceed accordingly as described under point 3. After “Program / Script” type in powershell.exe. And after “Add arguments (optional)” enter this line:

-NoProfile -executionpolicy bypass -Command „& ‚C:UsersteDocumentsWindowsPowerShellZIPCompressFolder.ps1‘ -Source ‚C:UsersteDocumentsZIPOrdner‘ -Target ‚C:Backup‘“ 

Create task via script:

The script “Task planning.ps1” shows you an example of how tasks can be created using a Powershell script. First, open the file in an editor and adjust the paths and the time of execution. Open a Powershell as administrator and run these two command lines:

cd $env:USERPROFILEDocumentsWindowsPowerShell 
powershell -ExecutionPolicy Bypass ./Aufgabenplanung.ps1 

6. Install PC-WELT Windows Service Center

PC-WELT Windows Service Center: Our tool enables the configuration and start of several maintenance tools. Some of them can be started regularly via the task scheduler.

Enlarge

PC-WELT Windows Service Center: Our tool enables the configuration and start of several maintenance tools. Some of them can be started regularly via the task scheduler.

About the

PC-WELT Windows Service Center
numerous useful tools can be started. The “1-click maintenance” offers you a selection of tools to start with the task planning. Sometimes this offers its own task planning. This is for example the registry backup tool and the defragmenter

Auslogics Disk Defrag
the case.

Unzip PC-WELT Windows-Service-Center into a folder without spaces or special characters, for example “C: pcwServiceCenter”. The tool and some of the programs it contains require the Microsoft .Net runtime environment from version 4.7. With Windows 8.1 and 10 it is already available as standard, with other systems you simply set up the runtime environment via the setup program “ndp48-web.exe” from the “Tools” directory of the PC-WELT Windows Service Center.

7. Configure PC-WELT Windows Service Center

After starting the tool, first click on “1-click maintenance” to get an overview of the existing automatic functions. Most tools need to be configured before they can run automatically. Behind each line you will see a reference in brackets to where the respective tool can be found.

An example:

If you want to clean up Windows, delete data (“Clean up PC”) and use Cleanmgr), click on the button with the arrow (“Back”) and then on “Clean up PC”. Here you will find two buttons related to the Cleanmgr program. First click on “Configure Cleanmgr”. Under “Files to be deleted:”, check the options you want, for example “Temporary files” and “Recycle bin”. Then click OK to save your settings.

Now click on the “Start Disk Cleanup” button. The tool starts the cleaning steps you have specified and then exits.

Activate automatic start:

After you have configured and tried Disk Cleanup, return to “1-Click Maintenance”. Put a tick in front of “Clean up Windows, delete data (clean up PC, Cleanmgr)”. To ensure the correct function, click on “Start”. Even now, the Cleanmgr tool should do its job according to the default settings.

If you have configured further programs later and activated them under “1-click maintenance”, the PC-WELT Windows Service Center carries out all tasks in sequence.

Click on “Schedule” and set the desired schedule, for example “Daily” and after “Start:” the time “13:00:00”. Enter the username and password of a user with administrator rights and click on “Schedule”. The task starts the batch file “C: Windows System32 pcwService Center.bat”. PC-WELT Windows Service Center takes care of the rest automatically.

Customize scripts:

Some tools are started by batch files. This applies to the backup with

Wimlib
and

Duplicati
(“Secure PC”) and download Windows updates via

Wsus offline
(“Update PC”). These tools have a button that can be used to open the batch file in the editor. Read the comments and adjust the configuration for your system.

Tags

Related Articles

Back to top button
Close
Close