-
- Influencer
- Posts: 11
- Liked: 3 times
- Joined: Oct 09, 2023 3:49 pm
- Contact:
How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
Hi everyone,
I'm trying to determine via PowerShell whether the "All public IP Addresses" checkbox is enabled in a Network Traffic Rule
$rules = Get-VBRNetworkTrafficRule
I’ve noticed that even when the "All public IP Addresses" checkbox is enabled in the GUI, the TargetIpStart and TargetIpEnd fields still show what appears to be default or previously set values — they don’t reflect the checkbox state.
And there is no property to check if is enabled or not.
This makes it difficult to programmatically determine whether the rule is targeting all public IPs.
Any insight or workaround would be greatly appreciated!
Thanks!
I'm trying to determine via PowerShell whether the "All public IP Addresses" checkbox is enabled in a Network Traffic Rule
$rules = Get-VBRNetworkTrafficRule
I’ve noticed that even when the "All public IP Addresses" checkbox is enabled in the GUI, the TargetIpStart and TargetIpEnd fields still show what appears to be default or previously set values — they don’t reflect the checkbox state.
And there is no property to check if is enabled or not.
This makes it difficult to programmatically determine whether the rule is targeting all public IPs.
Any insight or workaround would be greatly appreciated!
Thanks!
-
- Veeam Software
- Posts: 2838
- Liked: 650 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
Hi Kosk,
Regrettably there doesn't seem to be a supported means to retrieve this via Powershell or the REST API, but I'm not sure if this is intentional or not. I will check internally and report back.
Until then you can use the following unsupported workaround, though it's a little janky :/
[Moderator Edit: See below posts for updated solution]
This will return all of the rules in full directly from the database. While there isn't a property that explicitly tells if the All Public IP Addresses option is set, you can determine this by checking the value of SecondDiapason
Note: For unsupported .NET Reflection to work, you must first run _any_ normal VBR cmdlet. Get-VBRLicenseAutoUpdateStatus is chosen for convenience and speed of execution.
Regrettably there doesn't seem to be a supported means to retrieve this via Powershell or the REST API, but I'm not sure if this is intentional or not. I will check internally and report back.
Until then you can use the following unsupported workaround, though it's a little janky :/
Code: Select all
Get-VBRLicenseAutoUpdateStatus | Out-Null #Needed to load DLLs for .NET Reflection see notes
$rules = [Veeam.Backup.DBManager.CDBManager]::Instance.Options.GetTrafficThrottlingRules().GetRules()
This will return all of the rules in full directly from the database. While there isn't a property that explicitly tells if the All Public IP Addresses option is set, you can determine this by checking the value of SecondDiapason
If the SecondDiapason value = 192.168.0.1 and nothing else, it means the All Public IP box is checked. So a little out of the way solution here, but should allow you to workaround the issue while I check internally why this isn't reflected in the supported endpoints.RuleId : 8828387e-7592-46ba-87a8-3abd6a77b9f9
Name : Test Rule
SpeedLimit : 1
SpeedUnit : Mbps
AlwaysEnabled : True
EncryptionEnabled : False
ThrottlingEnabled : False
CanThrottleRestoreActivities : False
ThrottlingScheduleInfoStr : <scheduler><Sunday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Sunday><Monday>0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Monday><Tuesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0</Tuesday><Wednesday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0<
/Wednesday><Thursday>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Thursday><Friday>0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</Friday><Saturday>0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,0,0,0</Saturday></scheduler>
ScheduleCustomSpeedLimit : 1
ScheduleCustomSpeedUnit : Mbps
FirstDiapason : 192.168.0.1 - 192.168.0.255
SecondDiapason : 192.168.0.1
RuleIdDefault : 0e466a98-4bdb-4543-99d3-bdd82125c2f9
Note: For unsupported .NET Reflection to work, you must first run _any_ normal VBR cmdlet. Get-VBRLicenseAutoUpdateStatus is chosen for convenience and speed of execution.
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 11
- Liked: 3 times
- Joined: Oct 09, 2023 3:49 pm
- Contact:
Re: How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
Hi David,
Thanks for your reply, I just tried the workaround.
Getting a single rule to test, calling for the whole object I get SecondDiapason with a single result like your output.
But if I do $rule.SecondDiapason, I get FirstIP / LastIP object, which confuse me to really know if this have the All Public IP box check or not.
$rule.SecondDiapason
FirstIp LastIp IsPublic IsAny
------- ------ -------- -----
192.168.0.1 192.168.0.255 True False
IsPublic is something we can use?
Thanks!
Thanks for your reply, I just tried the workaround.
Getting a single rule to test, calling for the whole object I get SecondDiapason with a single result like your output.
But if I do $rule.SecondDiapason, I get FirstIP / LastIP object, which confuse me to really know if this have the All Public IP box check or not.
$rule.SecondDiapason
FirstIp LastIp IsPublic IsAny
------- ------ -------- -----
192.168.0.1 192.168.0.255 True False
IsPublic is something we can use?
Thanks!
-
- Veeam Software
- Posts: 2838
- Liked: 650 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
Hi Kosk,
You're very welcome. Actually, I must confess I made a mistake and assumed the SecondDiapason property was just returning a string and didn't check that it actually returns a CIPDiapason object that has the IsPublic property, which I now will recommend you filter on. Quick check in my lab shows this is reliable:
That returns correct results based on what I configured in the UI, so I would just check against $_.SecondDiapason.IsPublic for the script.
You're very welcome. Actually, I must confess I made a mistake and assumed the SecondDiapason property was just returning a string and didn't check that it actually returns a CIPDiapason object that has the IsPublic property, which I now will recommend you filter on. Quick check in my lab shows this is reliable:
Code: Select all
$allRules = [Veeam.Backup.DBManager.CDBManager]::Instance.Options.GetTrafficThrottlingRules().GetRules()
$allrules | select name, @{n="2nd Diapasan ToString";e={$_.SecondDiapason.ToString()}}, @{n="IsPublic?";e={$_.SecondDiapason.isPublic}}
Name 2nd Diapasan ToString IsPublic?
---- --------------------- ---------
Internet 192.168.0.1 True
Nutanix-to-VBR 172.21.237.11 - 172.21.237.11 False
VAW-encryption 172.21.237.11 - 172.21.237.11 False
VBR-repo-DR 172.21.237.150 - 172.21.237.150 False
Test Rule 192.168.0.1 True
David Domask | Product Management: Principal Analyst
-
- Influencer
- Posts: 11
- Liked: 3 times
- Joined: Oct 09, 2023 3:49 pm
- Contact:
Re: How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
Workaround was implemented and the script is running as expected.
Thanks David!
Thanks David!
-
- Veeam Software
- Posts: 2838
- Liked: 650 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: How to Detect "All public IP Addresses" Checkbox in Network Traffic Rules via PowerShell?
You're very welcome Kosk, glad we got it working.
Discussed internally, and agreed to include this in a supported way in a future release. Thanks for raising the topic!
Discussed internally, and agreed to include this in a supported way in a future release. Thanks for raising the topic!
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 3 guests