How to implement a backup folder on Yandex Disk schedule WinServ2003?

How to implement the following logic ?
There is a folder with the files
Need to after a certain period of time, we created a zip archive of this folder and uploaded to Yandex Disk
On the drive to keep N number of files with a name containing the date of backup
Archives older than the specified time are deleted
Desirable ready FOR
July 8th 19 at 11:11
4 answers
July 8th 19 at 11:13
For example, a folder with Andes the Disk is in D:\Yandex, the directory itself that needs to be archived - C:\Files.
Powershell Script:

Add-Type-Assembly “system.io.compression.filesystem”
$b=Get-Date-UFormat "%d.%m.%Y"
$src = “C:\Files”
$dst= “D:\Yandex\backup\$b\files.zip”
New-Item -Path "D:\Yandex\backup\$b" -ItemType "directory"
[io.compression.zipfile]::CreateFromDirectory($src, $dst)
$limit = (Get-Date).AddDays(-30)
$path = "D:\Yandex\backup"
# delete files older than the $limit.
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
# delete empty folders left after the deleted files
Get-ChildItem -Path $path -Recurse -Force | Where-Object { $_.PSIsContainer -and (Get-ChildItem -Path $_.FullName -Recurse -Force | Where-Object { !$_.PSIsContainer }) -eq $null } | Remove-Item -Force -Recurse


Create a job in task scheduler with a daily periodicity, the action-start powershell, the argument is the path to the script. Save, run.

Tests on 2012R2, Powershell for 2003 is old and may need changes to the script.
July 8th 19 at 11:15
What OS?
P. S. - the General answer is to write a script
July 8th 19 at 11:17
Scheduler and script.
July 8th 19 at 11:19

Find more questions by tags Backing upYandexInformation security