vat-software/scripts/task_setup.ps1
2023-03-24 14:18:51 +01:00

25 lines
844 B
PowerShell

$path = [Environment]::GetFolderPath("MyDocuments")
$path2 = "VAT-Software"
cd $path
if (Test-Path -LiteralPath (Join-Path $path $path2)) {
Remove-Item 'VAT-Software' -Recurse -Force -Confirm:$false
}
git clone https://git.iop.cz/vat/software.git VAT-Software
cd VAT-Software
git config credential.helper store
git config user.email "vat_emp@dalkove-ovladace.cz"
git config user.name "vat_emp"
$path = $path + "\VAT-Software" + "\cron.bat"
$action = New-ScheduledTaskAction -Execute $path
$trigger = New-ScheduledTaskTrigger -Daily -At 10am
if ($(Get-ScheduledTask -TaskName "git pull" -ErrorAction SilentlyContinue).TaskName -eq "git pull") {
Unregister-ScheduledTask -TaskName "git pull" -Confirm:$False
}
Register-ScheduledTask -Action $action -Trigger $trigger -TaskPath "MyTasks" -TaskName "git pull" -Description "git pull"