PowerShell script exchange
Post Reply
kjo@deif.com
Influencer
Posts: 13
Liked: 1 time
Joined: Feb 21, 2019 4:00 pm
Full Name: Kim Johansen
Contact:

How can i limit concurrent tasks of a Hyper-V host?

Post by kjo@deif.com »

Like the title says, how can i limit concurrent tasks of a Hyper-V host with powershell?

I have not been able to find a command to do this.

Thanks in advance. :)
DGrinev
Veteran
Posts: 1943
Liked: 247 times
Joined: Dec 01, 2016 3:49 pm
Full Name: Dmitry Grinev
Location: St.Petersburg
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by DGrinev »

Hi Kim,

Have you read the article Set-VBRBackupRepository in the PowerShell Reference guide?
Another one for the Hyper-V proxy is here where you can set MaxTasks.

That's all I could find related to the topic.

Thanks!
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by veremin »

If you post a screenshot or location of the UI setting you're talking about, we will be able to tell you the name of suitable PS cmdlet. Thanks!
kjo@deif.com
Influencer
Posts: 13
Liked: 1 time
Joined: Feb 21, 2019 4:00 pm
Full Name: Kim Johansen
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by kjo@deif.com »

Hi veremin and DGrinev

Sorry for not replying sooner, work happened. :)

You can find the setting in: BACKUP INFRASTUCTURE -> Managed Servers -> Microsoft Hyper-V -> Right-click on a Hyper-V Server -> Properties -> Apply -> Max Tasks.

This is what I'm looking for (instead of New it says Edit in the top):
Image

Add-VBRHvProxy has MaxTasks, but it is used when adding a Hyper-V Proxy. What I want is something like a Set-VBRHvProxy for modifying existing Hyper-V, but it doesn't appear to exist.
chris.arceneaux
VeeaMVP
Posts: 695
Liked: 374 times
Joined: Jun 24, 2019 1:39 pm
Full Name: Chris Arceneaux
Location: Georgia, USA
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by chris.arceneaux » 1 person likes this post

Hi Kim,

The code below will allow you to update an Off-Host proxy configuration.

Code: Select all

$proxy = Get-VBRHvProxy -Name '10.0.2.110'
$options = $proxy.Options
$options.MaxTasksCount = 2
$proxy.SetOptions($options)
If you're looking to update an On-Host proxy configuration, the below code will work on both types of proxies. Note that an undocumented function is used. Please use at your own risk as this is subject to change in the future.

Code: Select all

$HvProxies = [Veeam.Backup.Core.CHvProxy]::GetAll()
$proxy = $HvProxies | Where-Object {$_.Name -eq '10.0.2.110'}
$options = $proxy.Options
$options.MaxTasksCount = 2
$proxy.SetOptions($options)
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by oleg.feoktistov » 1 person likes this post

Hi Kim,

Adding to what Chris wrote - I also documented your comments as a feature request:
1. Set-VBRHvHost cmdlet.
2. -MaxTasks attribute for Add-VBRHvHost and Set-VBRHvHost (on-host backup proxy configuration).
3. Set-VBRHvProxy cmdlet (off-host backup proxy configuration).

Thanks!
Oleg
kjo@deif.com
Influencer
Posts: 13
Liked: 1 time
Joined: Feb 21, 2019 4:00 pm
Full Name: Kim Johansen
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by kjo@deif.com »

Thanks!
InfernalX64
Lurker
Posts: 2
Liked: never
Joined: Jul 01, 2020 2:18 pm
Full Name: Justin
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by InfernalX64 »

kjo@deif.com wrote: Feb 03, 2020 11:35 am Hi veremin and DGrinev

Sorry for not replying sooner, work happened. :)

You can find the setting in: BACKUP INFRASTUCTURE -> Managed Servers -> Microsoft Hyper-V -> Right-click on a Hyper-V Server -> Properties -> Apply -> Max Tasks.

This is what I'm looking for (instead of New it says Edit in the top):
Image

Add-VBRHvProxy has MaxTasks, but it is used when adding a Hyper-V Proxy. What I want is something like a Set-VBRHvProxy for modifying existing Hyper-V, but it doesn't appear to exist.
So glad I found this!
JRRW
Enthusiast
Posts: 78
Liked: 46 times
Joined: Dec 10, 2019 3:59 pm
Full Name: Ryan Walker
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by JRRW »

Did this get disabled? I'm getting an error now when trying to use this script.

Code: Select all

PS C:\scripts\> $options.MaxTasksCount = 6
The property 'MaxTasksCount' cannot be found on this object. Verify that the property exists and can be set.
At line:1 char:1
+ $options.MaxTasksCount = 6
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

PS C:\scripts> $options.maxtaskscount
4
4
4
4
4
So it pulls the maxtaskscount fine but doing an = isn't assigning a new value to the object.

Worked fine prior to 11/11a - wondering if they changed how this value is assigned/handled in powershell.

When looking at the hv details it almost seems like they added the maxtaskscount not as an option, unless it's always been this way, but still doesn't let you adjust it:

Code: Select all

PS C:\scripts> $proxy.maxtaskscount
4
4
4
4
4
PS C:\scripts> $proxy.maxtaskscount=6
The property 'maxtaskscount' cannot be found on this object. Verify that the property exists and can be set.
Digging in further to try another route, it looks like perhaps they set this read only:

Code: Select all

PS C:\scripts> Foreach($proxy_specific in $proxy){$proxy_specific.maxtaskscount = 6}
'maxtaskscount' is a ReadOnly property.
'maxtaskscount' is a ReadOnly property

Why Veeam? Why...
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How can i limit concurrent tasks of a Hyper-V host?

Post by oleg.feoktistov »

Hi Ryan,

In your first two code snippets it looks like you are trying to set the value for MaxTasksCount property for an array of proxies at once. If it is the case, makes sense that it doesn't work.

As for the read-only restriction, yes, our developers might have set it so. But as Chris mentioned in his message, this function is undocumented and a subject to changes in the future, which means it is not supported. Besides, setting properties on objects directly via Powershell is not a best practice and should be avoided unless no other way is available. Cmdlet parameters should be used instead. That's why I noted a feature request for this.

Thanks,
Oleg
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests