Enable a Disabled Backup Job

PowerShell script exchange

Re: Enable a Disabled Backup Job

Veeam Logoby CaptainFred » Mon Mar 24, 2014 1:18 pm

Yes those commands work?
CaptainFred
Enthusiast
 
Posts: 88
Liked: 2 times
Joined: Wed Jul 31, 2013 12:05 pm
Full Name: Si

Re: Enable a Disabled Backup Job

Veeam Logoby v.Eremin » Mon Mar 24, 2014 1:30 pm

The point was to test the way the variable is assigned. Whether it contains only one job, or multiple ones? So, what is shown in the pipeline if you run the said commands? One jobs or multiple ones? Also, you can try the Get-Member commandlet and see whether the given variable has "CanRunByScheduler()" method.

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

Re: Enable a Disabled Backup Job

Veeam Logoby CaptainFred » Mon Mar 24, 2014 1:45 pm

Ok well this is the output...

Code: Select all
PS C:\Scripts> $BackupJob = Get-VBRJob -name "Backup Job - MI"
PS C:\Scripts> $BackupJob

Job Name                  Type            State      Last Result  Description
--------                  ----            -----      -----------  -----------
Backup Job - MI           VMware Backup   Stopped    Failed


Not sure what exactly to input to do this "Get-Member commandlet and see whether the given variable has "CanRunByScheduler()" method" ?
CaptainFred
Enthusiast
 
Posts: 88
Liked: 2 times
Joined: Wed Jul 31, 2013 12:05 pm
Full Name: Si

Re: Enable a Disabled Backup Job

Veeam Logoby v.Eremin » Mon Mar 24, 2014 2:01 pm

Get-Member commandlet lists the parameter and properties the given object has. So, you can run the following script and see whether CanRunByScheduler() method is among those listed:

Code: Select all
$BackupJob = Get-VBRJob -name "Backup Job - MI"
$BackupJob | Get-Member


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

Re: Enable a Disabled Backup Job

Veeam Logoby CaptainFred » Mon Mar 24, 2014 2:26 pm

Doesn't appear so but could these be used...?

DisableScheduler Method System.Void DisableScheduler()
EnableScheduler Method System.Void EnableScheduler()

Code: Select all
PS C:\Scripts> $BackupJob = Get-VBRJob -name "Backup Job - MI"
PS C:\Scripts> $BackupJob | Get-Member


   TypeName: Veeam.Backup.Core.CBackupJob

Name                         MemberType Definition
----                         ---------- ----------
Delete                       Method     System.Void Delete()
DisableScheduler             Method     System.Void DisableScheduler()
EnableScheduler              Method     System.Void EnableScheduler()
Equals                       Method     bool Equals(System.Object obj)
FindInitialRepository        Method     Veeam.Backup.Core.CBackupRepository ...
FindLastSession              Method     Veeam.Backup.Core.CBackupSession Fin...
FindSourceWanAccelerator     Method     Veeam.Backup.Core.CWanAccelerator Fi...
FindTargetRepository         Method     Veeam.Backup.Core.CBackupRepository ...
FindTargetWanAccelerator     Method     Veeam.Backup.Core.CWanAccelerator Fi...
GetDiskEffectiveCompression  Method     int GetDiskEffectiveCompression()
GetFilesEffectiveCompression Method     int GetFilesEffectiveCompression()
GetHashCode                  Method     int GetHashCode()
GetHvOijs                    Method     Veeam.Backup.Core.HyperV.CHvOij[] Ge...
GetInitialRepository         Method     Veeam.Backup.Core.CBackupRepository ...
GetLastResult                Method     Veeam.Backup.Model.CBaseSessionInfo+...
GetLastState                 Method     Veeam.Backup.Model.CBaseSessionInfo+...
GetObjectsInJob              Method     Veeam.Backup.Core.CObjectInJob[] Get...
GetOptions                   Method     Veeam.Backup.Model.CJobOptions GetOp...
GetProxy                     Method     System.Collections.Generic.IEnumerab...
GetScheduleOptions           Method     Veeam.Backup.Model.ScheduleOptions G...
GetSourceOffHostHvProxies    Method     Veeam.Backup.Core.CHvProxy[] GetSour...
GetSourceViProxies           Method     Veeam.Backup.Core.CViProxy[] GetSour...
GetSourceWanAccelerator      Method     Veeam.Backup.Core.CWanAccelerator Ge...
GetTargetHost                Method     Veeam.Backup.Core.CHost GetTargetHost()
GetTargetOffhostHvProxies    Method     Veeam.Backup.Core.CHvProxy[] GetTarg...
GetTargetProxies             Method     System.Collections.Generic.IEnumerab...
GetTargetRepository          Method     Veeam.Backup.Core.CBackupRepository ...
GetTargetViProxies           Method     Veeam.Backup.Core.CViProxy[] GetTarg...
GetTargetWanAccelerator      Method     Veeam.Backup.Core.CWanAccelerator Ge...
GetType                      Method     type GetType()
GetVcdOijs                   Method     Veeam.Backup.Core.CObjectInJob[] Get...
GetViOijs                    Method     Veeam.Backup.Core.CObjectInJob[] Get...
GetVssOptions                Method     Veeam.Backup.Model.CVssOptions GetVs...
IsFileCopy                   Method     bool IsFileCopy()
IsInBackupWindow             Method     bool IsInBackupWindow(System.DateTim...
IsStopped                    Method     bool IsStopped()
IsWanAcceleratorEnabled      Method     bool IsWanAcceleratorEnabled()
LogHvProxySettings           Method     System.Void LogHvProxySettings()
LogJobOptions                Method     System.Void LogJobOptions(Veeam.Back...
LogJobSession                Method     System.Void LogJobSession(Veeam.Back...
Reload                       Method     System.Void Reload()
ResetScheduleDependentJobs   Method     System.Void ResetScheduleDependentJo...
SetLatestRecheck             Method     System.Void SetLatestRecheck(System....
SetOptions                   Method     System.Void SetOptions(Veeam.Backup....
SetScheduleDependentJobs     Method     System.Void SetScheduleDependentJobs...
SetVssOptions                Method     System.Void SetVssOptions(Veeam.Back...
SureMoveObj                  Method     System.Void SureMoveObj(System.Guid ...
SureObjAdded                 Method     System.Void SureObjAdded(System.Guid...
ToString                     Method     string ToString()
CaptainFred
Enthusiast
 
Posts: 88
Liked: 2 times
Joined: Wed Jul 31, 2013 12:05 pm
Full Name: Si

Re: Enable a Disabled Backup Job

Veeam Logoby v.Eremin » Mon Mar 24, 2014 2:40 pm

As mentioned above, these methods are responsible for disabling/enabling job, not for providing information about schedule, in general. However, there is a property called .IsScheduleEnabled that can be used as a substitute for .CanRunBySheduler() method ; so, you might try and see whether it's present in your PS or not.

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

Re: Enable a Disabled Backup Job

Veeam Logoby tsightler » Mon Mar 24, 2014 3:51 pm

When scripts fail to run due to missing parameters/methods that really should exist I've generally found this to be caused by an outdated Powershell version, especially common on Windows 2008/2008R2 systems. If you haven't already done so I'd strongly suggest upgrading to at least Powershell 3.0, available at the following link:

http://www.microsoft.com/en-us/download ... x?id=34595
tsightler
Veeam Software
 
Posts: 4765
Liked: 1737 times
Joined: Fri Jun 05, 2009 12:57 pm
Full Name: Tom Sightler

Re: Enable a Disabled Backup Job

Veeam Logoby CaptainFred » Mon Mar 24, 2014 4:09 pm

tsightler wrote:When scripts fail to run due to missing parameters/methods that really should exist I've generally found this to be caused by an outdated Powershell version, especially common on Windows 2008/2008R2 systems. If you haven't already done so I'd strongly suggest upgrading to at least Powershell 3.0, available at the following link:

http://www.microsoft.com/en-us/download ... x?id=34595


Ah I see, I'll try this. Thanks
CaptainFred
Enthusiast
 
Posts: 88
Liked: 2 times
Joined: Wed Jul 31, 2013 12:05 pm
Full Name: Si

Re: Enable a Disabled Backup Job

Veeam Logoby CaptainFred » Mon Mar 31, 2014 11:34 am

tsightler wrote:When scripts fail to run due to missing parameters/methods that really should exist I've generally found this to be caused by an outdated Powershell version, especially common on Windows 2008/2008R2 systems. If you haven't already done so I'd strongly suggest upgrading to at least Powershell 3.0, available at the following link:

http://www.microsoft.com/en-us/download ... x?id=34595


That fixed it! Thanks :)
CaptainFred
Enthusiast
 
Posts: 88
Liked: 2 times
Joined: Wed Jul 31, 2013 12:05 pm
Full Name: Si

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 8 guests