Benutzer-Werkzeuge

Webseiten-Werkzeuge


Seitenleiste

powershell:scheduledjob

ScheduledJob

Vorbereitungen

Jobtrigger definieren

$trigger = New-JobTrigger -At 11:30 -Once -RepetitionInterval (New-TimeSpan -Minutes 10) -RepeatIndefinitely

Credentials in Variable speichern

$yourCred = Get-Credential

Job-Optionen

$options = New-ScheduledJobOptions ...

Job registrieren

$job = Register-ScheduledJob -FilePath "c:\your\script\here.ps1" -Name "PSH-AutoTask-DevServer" -Trigger $trigger -Credential $yourCreds -ScheduledJobOptions $options

Trigger hinzufügen

$job = Get-ScheduledJob
Add-JobTrigger -InputObject $job[0] -Trigger (New-JobTrigger -At "01.01.2019 20:00" -Once)

Mögliche Probleme

Häkchen bei "Passwort nicht speichern" gesetzt

Get-ScheduledJob | Set-Scheduledjob -Credential (Get-Credential)
powershell/scheduledjob.txt · Zuletzt geändert: 2018/08/20 09:30 von ronny