From 96d03ef620e2c014a926ff8243cfe3d719493f4e Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Tue, 27 Aug 2024 21:28:44 +0200 Subject: [PATCH] session(firewall/monitor): Fix when use FortiOS 7.6.0 We need to use sessions and not session for uri (already available with fortiOS 7.4.x...) --- PowerFGT/Public/monitor/firewall/session.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PowerFGT/Public/monitor/firewall/session.ps1 b/PowerFGT/Public/monitor/firewall/session.ps1 index 4d10bcbba..e9eadcaf2 100644 --- a/PowerFGT/Public/monitor/firewall/session.ps1 +++ b/PowerFGT/Public/monitor/firewall/session.ps1 @@ -67,7 +67,13 @@ function Get-FGTMonitorFirewallSession { $count = 1000 } - $uri = "api/v2/monitor/firewall/session?count=${count}" + #before 7.6.x, it is session (and not sessions) (already available with 7.4.x) but session drop with 7.6.) + if ($connection.version -lt "7.6.0") { + $uri = "api/v2/monitor/firewall/session?count=${count}" + } + else { + $uri = "api/v2/monitor/firewall/sessions?count=${count}" + } if ( $PsBoundParameters.ContainsKey('summary') ) { $uri += "&summary=$true"