-
Notifications
You must be signed in to change notification settings - Fork 0
/
enable-veeam-job-schedules.ps1
51 lines (40 loc) · 2.79 KB
/
enable-veeam-job-schedules.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<#
.SYNOPSIS
Enable all scheduled Veeam Jobs previously diables with disable-veeam-job-schedules. Read the jobs in
HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Temporarily Disabled Jobs\[JOB NAME] enable the jobs, and remove the registry entries.
.DESCRIPTION
.NOTES
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ enable-veeam-job-schedules.ps1 │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ DATE : 2019.1.4 │
│ AUTHOR : Paul Drangeid │
│ DESCRIPTION : Initial Beta Draft v0.1 │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
#>
$global:scriptname = $($MyInvocation.MyCommand.Name)
Write-Host "`nLoading includes: $pwd\bg-sharedfunctions.ps1"
Try{. "$pwd\bg-sharedfunctions.ps1" | Out-Null}
Catch{
Write-Warning "I wasn't able to load the sharedfunctions includes. We are going to bail now, sorry 'bout that! "
Write-Host "Try running them manually, and see what error message is causing this to puke: .\bg-sharedfunctions.ps1"
BREAK
}
Prepare-EventLog
#LogError "this is the actual error" "And here's some details to help provide context for the errors."
Add-PSSnapin -Name VeeamPSSnapIn
$Path = "HKLM:\Software\Veeam\Temporarily Disabled Jobs"
$Keys=Get-ChildItem $Path
ForEach ($Key in $Keys) {
Write-Host "Try to re-enable "$($Key.PSchildname)
$Result = Enable-VBRJobSchedule -Job $($Key.PSchildname)
$EnabledJob=Get-VBRJob -Name $($Key.PSchildname)
if (![string]::IsNullorEmpty($EnabledJob.ScheduleOptions.NextRun)){
Write-Host "Successfully Enabled Veeam Job '$($Key.PSchildname)'"
$RegPath = -Join($Path,"\",$($Key.PSchildname))
Write-Host $RegPath
Remove-Item -path $RegPath -Recurse | Out-Null
}# Next run is nolonger blank
}# Key