PowerShell script exchange
Post Reply
thethommyy
Influencer
Posts: 10
Liked: 2 times
Joined: Apr 12, 2018 3:16 pm
Full Name: KDV Support
Contact:

automatically disable/enable Jobs

Post by thethommyy » 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

ravatheodor
Veeam Software
Posts: 2
Liked: 1 time
Joined: Dec 22, 2016 1:07 pm
Full Name: Razvan Ionescu
Contact:

Re: automatically disable/enable Jobs

Post by ravatheodor » 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 ... 47762.html

v.Eremin
Product Manager
Posts: 15967
Liked: 1284 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: automatically disable/enable Jobs

Post by v.Eremin » 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.

thethommyy
Influencer
Posts: 10
Liked: 2 times
Joined: Apr 12, 2018 3:16 pm
Full Name: KDV Support
Contact:

Re: automatically disable/enable Jobs

Post by thethommyy » Aug 08, 2018 5:16 am

Good Morning,

thank you very much, I'll try it.

Thomas

thethommyy
Influencer
Posts: 10
Liked: 2 times
Joined: Apr 12, 2018 3:16 pm
Full Name: KDV Support
Contact:

Re: automatically disable/enable Jobs

Post by thethommyy » 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
Influencer
Posts: 10
Liked: 2 times
Joined: Apr 12, 2018 3:16 pm
Full Name: KDV Support
Contact:

Re: automatically disable/enable Jobs

Post by thethommyy » 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

v.Eremin
Product Manager
Posts: 15967
Liked: 1284 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: automatically disable/enable Jobs

Post by v.Eremin » 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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests