-
- Expert
- Posts: 231
- Liked: 18 times
- Joined: Dec 07, 2009 5:09 pm
- Full Name: Chris
- Contact:
Bug in Get-VBRJob IsScheduleEnabled?
Hello,
Why does "IsScheduleEnabled" returned True for jobs that are not scheduled? Please see the screenshot. Shouldn't he two jobs highlighted in red be returning False?
On a separate note, why is "Name" recognized as a parameter of Get-VBRJob but IsScheduleEnabled and other parameters are not?
Why does "IsScheduleEnabled" returned True for jobs that are not scheduled? Please see the screenshot. Shouldn't he two jobs highlighted in red be returning False?
On a separate note, why is "Name" recognized as a parameter of Get-VBRJob but IsScheduleEnabled and other parameters are not?
-- Chris
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Bug in Get-VBRJob IsScheduleEnabled?
Because this parameter shows the general state of a given job – whether it’s enabled or disabled. If you disable a job, the said parameter will output “True”. Otherwise, it will output “False”.Why does "IsScheduleEnabled" returned True for jobs that are not scheduled?
The parameter you’re looking for is .CanRunByScheduler(), so, the script should look like this:
Code: Select all
Get-VBRjob | select name, {$_.canrunbyscheduler()} |ft -AutoSize
This is by design. In order to sort the jobs by given parameter you should use the following script:On a separate note, why is "Name" recognized as a parameter of Get-VBRJob but IsScheduleEnabled and other parameters are not?
Code: Select all
Get-VBRjob | where {$_.canrunbyscheduler() -eq $True}
-
- Expert
- Posts: 231
- Liked: 18 times
- Joined: Dec 07, 2009 5:09 pm
- Full Name: Chris
- Contact:
Re: Bug in Get-VBRJob IsScheduleEnabled?
Thanks for the information. canrunbyscheduler() doesn't appear in the list when I do "Get-VBRJob | fl" so how should I have gone about discovering that function?
On the second part, I think I may have a misunderstanding of PS cmdlets. What's confusing is that cmdlets seem to have an inconsistency in which parameters they expose as arguments. For example, Get-Service exposes Name and DisplayName but not Status. So I can do "Get-Service -Name *search*" but not "Get-Service -Status stopped". Instead I have to do "Get-Service | ? status -eq stopped". Do you know why?
edit: Let me clarify that question. Do you know why cmdlets don't expose every key as a parameter for the command?
On the second part, I think I may have a misunderstanding of PS cmdlets. What's confusing is that cmdlets seem to have an inconsistency in which parameters they expose as arguments. For example, Get-Service exposes Name and DisplayName but not Status. So I can do "Get-Service -Name *search*" but not "Get-Service -Status stopped". Instead I have to do "Get-Service | ? status -eq stopped". Do you know why?
edit: Let me clarify that question. Do you know why cmdlets don't expose every key as a parameter for the command?
-- Chris
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Bug in Get-VBRJob IsScheduleEnabled?
You can use Get-Member function in order to see all the parameters/functions a job has:how should I have gone about discovering that function?
Code: Select all
Get-VBRJob -name "Name of backup Job" | Get-Member
I believe, it’s just the way the cmdlets are written. The writer decides whether or not to expose certain parameters this way. Thanks.Do you know why?
-
- Expert
- Posts: 231
- Liked: 18 times
- Joined: Dec 07, 2009 5:09 pm
- Full Name: Chris
- Contact:
-
- VP, Product Management
- Posts: 6035
- Liked: 2860 times
- Joined: Jun 05, 2009 12:57 pm
- Full Name: Tom Sightler
- Contact:
Re: Bug in Get-VBRJob IsScheduleEnabled?
I think it's fair to say that no (or at least very few) cmdlets expose every possible property of an object as a command line option. There are some that are pretty much considered "standard" such as "Name", and others which are more left up to discretion based on use case. This isn't unique to Veeam Powershell as more as a base concept of powershell and part of it's power.cparker4486 wrote:edit: Let me clarify that question. Do you know why cmdlets don't expose every key as a parameter for the command?
For example, take the "Get-VM" parameter from the vSphere PowerCLI powershell interface, it provides command line parameters to filter on things like Datastore, Location, Name, Id, and I think a couple of others, but what if you want to query only VMs that are currently powered on? There's no command line parameter for that, you simply fall back to leveraging the object model for the VM, something like:
Code: Select all
Get-VM | where { $_.PowerState -eq “PoweredOn”}
Who is online
Users browsing this forum: No registered users and 13 guests