Hello. I'm trying to make "bulk" changes to about 60 rules I have configured on my VBR server. I have the names of the rules themselves saved to a text file.
If I read the file and use "Get-VBRNetworkTrafficRule", it works fine and gives me every rule I have configured:
Get-Content <filename> |ForEach-Object {Get-VBRNetworkTrafficRule -Name $_ }
or
foreach ($LINE in Get-Content <filename>) {get-VBRNetworkTrafficRule -name $LINE}
Both of the above work fine and output all the rules as expected.
But when I use this same command structure with "Set-VBRNetworkTrafficRule ", the cmdlet prompts me for the Rule Name, like it's not accepting the input from "Get-Content" :
Get-Content <filename> |ForEach-Object {Set-VBRNetworkTrafficRule -Name $_ -ThrottlingValue 50}
or
foreach ($LINE in Get-Content <filename>) {set-VBRNetworkTrafficRule -name $LINE -ThrottlingValue 50}
I get:
cmdlet Set-VBRNetworkTrafficRule at command pipeline position 1
Supply values for the following parameters:
Rule:
Any feedback would be appreciated!
-
- Novice
- Posts: 7
- Liked: never
- Joined: Dec 22, 2022 3:01 pm
- Contact:
-
- Novice
- Posts: 7
- Liked: never
- Joined: Dec 22, 2022 3:01 pm
- Contact:
Re: trying to script changes to Network Throttling rules
Update -- OK so I figured out that I need to "Get" each rule before I can modify it (which seems bizarre if I already have the names of the rules I want to modify, but I can deal with it)
Now I'm having trouble modifying the rules, specifically the "ThrottlingWindowOptions" in powershell
I can enable the throttling with "-EnableThrottlingWindow" - that works great with my "foreach" loop
But when I try to do "set-vbrnetworktrafficrules -Rule $RULE -ThrottlingWindowOptions 0,0,0,0,0,0,0,0, ..... etc (I copied these values directly from a rule I modified manually so I could get the format/sequence correct) -- the script gives an error:
et-VBRNetworkTrafficRule : Cannot convert 'System.Object[]' to the type 'Veeam.Backup.PowerShell.Infos.VBRBackupWindowOptions' required by parameter 'ThrottlingWindowOptions'.
Specified method is not supported.
what's the correct format/syntax for speciifying this ThrottlingWindow parameter?
Here's my script: (I've made sure the window options doesn't have any spaces or line breaks - ven running it manually against a specific rule gives the error)
foreach ($LINE in get-content <filename>) {
$RULE = get-vbrnetworktrafficrule -Name $LINE
set-vbrnetworktrafficrule -Rule $RULE -ThrottlingWindowOptions 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
clear-variable -Name RULE }
Now I'm having trouble modifying the rules, specifically the "ThrottlingWindowOptions" in powershell
I can enable the throttling with "-EnableThrottlingWindow" - that works great with my "foreach" loop
But when I try to do "set-vbrnetworktrafficrules -Rule $RULE -ThrottlingWindowOptions 0,0,0,0,0,0,0,0, ..... etc (I copied these values directly from a rule I modified manually so I could get the format/sequence correct) -- the script gives an error:
et-VBRNetworkTrafficRule : Cannot convert 'System.Object[]' to the type 'Veeam.Backup.PowerShell.Infos.VBRBackupWindowOptions' required by parameter 'ThrottlingWindowOptions'.
Specified method is not supported.
what's the correct format/syntax for speciifying this ThrottlingWindow parameter?
Here's my script: (I've made sure the window options doesn't have any spaces or line breaks - ven running it manually against a specific rule gives the error)
foreach ($LINE in get-content <filename>) {
$RULE = get-vbrnetworktrafficrule -Name $LINE
set-vbrnetworktrafficrule -Rule $RULE -ThrottlingWindowOptions 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
clear-variable -Name RULE }
-
- Veeam Software
- Posts: 2320
- Liked: 556 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: trying to script changes to Network Throttling rules
Hi @n3rdling
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
So you'll pass your formatted option there as the argument.
So:
1. Get all rules into an array.
2. Loop over the array and for each item, make the necessary edits to the object/property(ies)
3. Set the appropriate properties.
https://helpcenter.veeam.com/docs/backu ... ml?ver=120
You need to fetch the object with Get-VBRNetworkTrafficRule and edit the VBRBackupWindowOptions property:Specifies the time intervals during which Veeam Backup & Replication must apply a network traffic rule.
Accepts the VBRBackupWindowOptions type.
Code: Select all
PS C:\Users\Administrator> $rules[1].ThrottlingWindowOptions.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True False VBRBackupWindowOptions Veeam.Backup.PowerShell.Infos.VBRObject
So:
1. Get all rules into an array.
2. Loop over the array and for each item, make the necessary edits to the object/property(ies)
3. Set the appropriate properties.
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 27 guests