FortiPower / PowerFGT

PowerShell module to manage Fortinet (FortiGate) Firewall
Apache License 2.0
107 stars 36 forks source link

Set/Remove-FGTFirewallAddress not working when piping object from Get-FGTFirewallAddress #132

Closed timothymmurphy closed 3 years ago

timothymmurphy commented 3 years ago

I can successfully retrieve address information from Get-FGTFirewallAddress, but when piping the output of that to Set-FGTFirewallAddress to make changes to that address I receive an error:

PS C:\Users\a-timothy.murphy> Get-FGTFirewallAddress -name 10.100.13.235

name                 : 10.100.13.235
q_origin_key         : 10.100.13.235
uuid                 : 8c606492-3fc7-51eb-07bd-d7a98c853186
subnet               : 10.100.13.235 255.255.255.255
type                 : ipmask
sub-type             : sdn
clearpass-spt        : unknown
start-mac            : 00:00:00:00:00:00
end-mac              : 00:00:00:00:00:00
country              :
cache-ttl            : 0
sdn                  :
fsso-group           : {}
interface            :
comment              : TM 12/16/20
visibility           : enable
associated-interface :
color                : 0
filter               :
sdn-addr-type        : private
obj-id               :
list                 : {}
tagging              : {}
allow-routing        : disable

PS C:\Users\a-timothy.murphy> Get-FGTFirewallAddress -name 10.100.13.235 | Set-FGTFirewallAddress -comment "Test"
Set-FGTFirewallAddress : Cannot validate argument on parameter 'address'. Element specified does not contain an fqdn
property.
At line:1 char:46
+ ... lAddress -name 10.100.13.235 | Set-FGTFirewallAddress -comment "Test"
+                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (@{name=10.100.1...outing=disable}:PSObject) [Set-FGTFirewallAddress], Para
   meterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Set-FGTFirewallAddress
alagoutte commented 3 years ago

Hi Tim !

what PowerFGT release and FortiOS release ?

timothymmurphy commented 3 years ago

PowerFGT v0.4.1, FortiOS v6.2.2

alagoutte commented 3 years ago

Ok, can you update to 0.5.0 (release yesterday !) there is already a fix for this

Only need to use

Update-Module PowerFGT
timothymmurphy commented 3 years ago

Ah! I just downloaded for the first time yesterday and it must have been before this update was released. This fixed it, thank you.