automatically disable/enable Jobs

PowerShell script exchange

automatically disable/enable Jobs

Veeam Logoby thethommyy » Tue Aug 07, 2018 9:52 am

Hello,

I know that this post is very old, but I've a question:

I would like to enable / disable automaticly a backupjob with powershell.

Is this the right powershell script:

asnp VeeamPSSnapin
xyJob.DisableScheduler()
respectively
xyJob.EnableScheduler()

We run VB&R 9.5 on a Windows 2012R2-Server.

Thank you !
Thomas
thethommyy
Novice
 
Posts: 6
Liked: never
Joined: Thu Apr 12, 2018 3:16 pm
Full Name: KDV Support

Re: automatically disable/enable Jobs

Veeam Logoby ravatheodor » Tue Aug 07, 2018 12:06 pm

Hi Thomas,
For 9.5 U3 there are powershell cmdlets available - Enable-VBRJobSchedule and Disable-VBRJobSchedule. Script would like this:
Code: Select all
Get-VBRJob -Name "My Backup Job Name" | Enable-VBRJobSchedule


Please have a look at this post also https://forums.veeam.com/powershell-f26/is-enablescheduler-always-available-t47762.html
ravatheodor
Veeam Software
 
Posts: 2
Liked: never
Joined: Thu Dec 22, 2016 1:07 pm
Full Name: Razvan Ionescu

Re: automatically disable/enable Jobs

Veeam Logoby v.Eremin » Tue Aug 07, 2018 2:50 pm

The script above disables/enables job schedule. If you'd like to enable/disable job itself, you should Enable-VBRJob and Disable-VBRJob cmdlets instead. Thanks.
v.Eremin
Veeam Software
 
Posts: 14966
Liked: 1122 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: automatically disable/enable Jobs

Veeam Logoby thethommyy » Wed Aug 08, 2018 5:16 am

Good Morning,

thank you very much, I'll try it.

Thomas
thethommyy
Novice
 
Posts: 6
Liked: never
Joined: Thu Apr 12, 2018 3:16 pm
Full Name: KDV Support

Re: automatically disable/enable Jobs

Veeam Logoby thethommyy » Wed Aug 08, 2018 6:49 am

Hello,

it works, but how can I start this Veeam-Powershell-script by a Windows Batch file ?
My goal is to create a Windows batch file that runs in the morning and evening to enable / disable a Veeam backup Job.

Thank you !
Thomas
thethommyy
Novice
 
Posts: 6
Liked: never
Joined: Thu Apr 12, 2018 3:16 pm
Full Name: KDV Support

Re: automatically disable/enable Jobs

Veeam Logoby thethommyy » Wed Aug 08, 2018 8:21 am

Hello,

I think / hope I've got it:

the PS1-Script:
Add-PSSnapin -Name VeeamPSSnapIn
Get-VBRJob -Name "My Backup Job" | Disable-VBRJob

I start this PS1-script by a Windows Batch file.

The Problem is, this script has to start by Admin and I have to Change the HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication permissions ......

Thomas
thethommyy
Novice
 
Posts: 6
Liked: never
Joined: Thu Apr 12, 2018 3:16 pm
Full Name: KDV Support

Re: automatically disable/enable Jobs

Veeam Logoby v.Eremin » Wed Aug 08, 2018 12:10 pm

Correct, admin account or permission on certain registry hives is necessary.

You're also right that before using any Veeam specific cmdlet you need to add our snap-in, using Add-PSSnapin cmdlet.

Thanks.
v.Eremin
Veeam Software
 
Posts: 14966
Liked: 1122 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests