Created
January 21, 2019 14:51
-
-
Save WimObiwan/488f5ad8ea5a88f55255621ca4144173 to your computer and use it in GitHub Desktop.
ScheduledJob
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$command = 'C:\SQLBackups\DoBackup.ps1' | |
# trigger hourly | |
$trigger = New-JobTrigger -Once -At '2015-01-01' -RepetitionInterval (New-TimeSpan -Hour 1) -RepetitionDuration ([TimeSpan]::MaxValue) | |
$cred = Get-Credential | |
Register-ScheduledJob -FilePath $command -Name SQLBackup -Trigger $trigger -Credential $cred | |
# Troubleshooting | |
Get-Job | |
Receive-Job -Keep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment