Advanced Topics on Windows Task Scheduler
Use of Managed Service Accounts (gMSA), automation in the context of security, Event Viewer log tracking and PowerShell 7.4+ integration.
Meet 2026's modern server management standards. Automate repetitive tasks on your Windows VDS and physical servers, create PHP cron jobs, and effortlessly manage system maintenance with PowerShell. Discover the power of automation with Eka Sunucu's high-performance infrastructure.
Windows Task Scheduler is a powerful management tool that allows programs or scripts to run automatically in Windows operating systems at predefined times or when certain events occur (a computer turning on, a user logging in, etc.). on Linux systems Cron Job It is the Windows equivalent of the structure and modern Windows VDS is the backbone of management.
Automate routine tasks such as daily, weekly or monthly reporting, database cleanup and system updates.
Run your website's background processes (email sending, order checking) on the server side without the need for a browser.
Regularly back up your critical files and SQL databases and move them to secure areas without human error.
Create scripts that monitor server resources and automatically intervene in certain situations (high CPU, low disk).
Accessing Task Scheduler on Windows Server 2019, 2022 or 2025 is quite simple. Correct configuration is critical to the security and performance of your server.
# Görev Zamanlayıcıyı komut lineından hızlıca açmak for: Start-Process "taskschd.msc" # Veya mevcut görevleri listelemek for PowerShell kullanabilirsiniz: Get-ScheduledTask | Where-Object { $_.State -eq 'Running' }
One of the features most frequently needed by web developers is the automatic execution of certain PHP files (e.g. invoice creation, mail queue processing). To do this on Windows php.exeWe use .
First, let's have a simple PHP file that will run automatically. This file will record in a log file.
<?php // Zaman dilimi ayarı date_default_timezone_set('Europe/Istanbul'); // Log dosyasının yolu $logFile = __DIR__ . '/gorev_loglari.txt'; $time = date('Y-m-d H:i:s'); // Structurelacak işlem (Örn: Veritabanı temizliği, mail gönderimi) // Simülasyon: $message = "[{$time}] Otomatik gorev basariyla calisti." . PHP_EOL; // Log dosyasına yaz file_put_contents($logFile, $message, FILE_APPEND); echo "Worklem tamamlandı."; ?>
Instead of calling PHP directly, a .bat Creating a file and introducing it to Task Scheduler is easier to manage and simplifies debugging.
:: Eka Sunucu Otomasyon Scripti @echo off :: PHP.exe'nin tam yolu (Sunucunuzdaki yola göre değiştirin) set PHP_BIN="C:\Program Files\PHP\v8.3\php.exe" :: Çalıştırılacak PHP dosyasının yolu set SCRIPT="C:\inetpub\wwwroot\otomasyon\cron.php" :: Scripti çalıştır %PHP_BIN% -f %SCRIPT% :: İsteğe bağlı: Pencereyi kapat exit
run_cron.bat Show the full path to the file..bat Type the folder path where the file is located (Ex: C:\inetpub\wwwroot\otomasyon\). This is critical to avoid corrupting file paths (include/require).The most powerful tool on Windows servers is PowerShell. The script below compresses (ZIP) your website files and moves them to the backup folder, date-stamped. It also automatically deletes backups older than 7 days.
# --- Eka Sunucu Automatic Backup. Scripti --- # Ayarlar $Source = "C:\inetpub\wwwroot\projem" # Yedeklenecek Klasör $Destination = "D:\Yedekler" # Yedeğin Atılacağı Yer $Date = Get-Date -Format "yyyy-MM-dd_HH-mm" $ZipPath = "$Destination\Yedek_$Date.zip" # Klasör yoksa create if (!(Test-Path -Path $Destination)) { New-Item -ItemType Directory -Path $Destination } # Dosyaları Sıkıştır Compress-Archive -Path $Source -DestinationPath $ZipPath -Force Write-Host "Yedekleme Tamamlandı: $ZipPath" # 7 Günden eski dosyaları temizle (Disk doluluğunu önlemek for) $DaysLimit = 7 Get-ChildItem -Path $Destination -Filter "*.zip" | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-$DaysLimit) } | Remove-Item Write-Host "Eski yedekler temizlendi."
To Add This Script to Task Scheduler:
As Program/script in Action section: powershell.exe
In the Add arguments section: -ExecutionPolicy Bypass -File "C:\Scripts\Backup-Web.ps1"
High-performance Windows servers with NVMe SSD disks for your automation processes.
Error code 0x1 is usually a "authorization" or "path" error. Check the following: 1) Is "Run with highest privileges" selected in the task properties? 2) Is the "Start in" folder path defined as the folder where the script is located? 3) Is the user account you are using authorized to run the script?
In Windows operating systems, the term "Task Scheduler" is used instead of "Cron Job". Everything you do with crontab commands in Linux, you can do with Task Scheduler's visual interface or PowerShell commands.
Yes, if you select "At Startup" as the Trigger when creating the task, your task will run automatically every time the server restarts. It may be a good practice to add a delay for web server services (IIS, Apache, Nginx) to start.
All physical and in our virtual server packages, initial installation and optimization support is free. You can contact our professional support team for advanced automation setups and special script software.
Combine the power of automation with the high-performance Eka Sunucu infrastructure.
Hosting Solutions Contact Us