Skip to main content
alagoutte
New Member
May 17, 2019
Solved

PowerFGT: a PowerShell module for FortiGate

Hi,

I have been working for several months on a PowerShell module that uses the FortiGate REST API.

 

This module is available on psgallery(.com) : https://www.powershellgallery.com/packages/PowerFGT

Actually, we support to connect to HTTPS or HTTP

and use the following feature :

[ul]
  • Address (Add/Get/Copy/Set/Remove object type ipmask/subnet)
  • AddressGroup (Add/Get/Copy/Set/Remove and Add/Remove Member)
  • DNS (Get)
  • HA (Get)
  • Interface (Get)
  • IP Pool (Get)
  • Local User (Get)
  • Policy (Add/Get/Remove)
  • RoutePolicy (Get)
  • Service (Get)
  • Service Group (Get)
  • Static Route (Get)
  • System Global (Get)
  • VDOM (Get)
  • Virtual IP (Get/Add/Remove object type static-nat)
  • Virtual WAN Link/SD-WAN (Get)
  • VPN IPsec Phase 1/Phase 2 Interface (Get)
  • Zone (Get)[/ul]

     

    it is very easy to use (and install)

     

    Launch PowerShell command line and launch following command for install

    Install-Module PowerFGT

    for load the module

    Import-Module PowerFGT

    Connect to your firewall

    Connect-FGT 192.0.2.1

    You get a prompt to ask credential

     

    for example to get all address use

    Get-FGTFirewallAddress

    You can get the list of command available via

    Get-Command -Module PowerFGT

     

     and for get help (and example about a command for example Add-FGTFirewallAddress)

    Get-Help Add-FGTFirewallAddress -Full

     

    More documentation, example is available on https://github.com/FortiPower/PowerFGT and you can also report issue/enhance !

     

    • alagoutte
      alagoutteAnswer
      New Member
      January 14, 2020

      A new release of PowerFGT (0.40 is available on PSGallery => https://www.powershellgallery.com/packages/PowerFGT/

      [ul]
    • Enhance Filtering (using directly API) (#58, #62)
    • Add Add/Set/Remove (and member) Address Group (#57)
    • Add Add/Set/Remove Virtual IP (VIP) (#54)
    • Add Add/Remove (and member) Firewall Policy (#65, #68)
    • Add Deploy-FGTVm for deploy FortiGate vapp (#34)
    • Add Timeout setting for Connect-FGT (and Invoke-FGTRestMethod) (#56)[/ul]

      Documentation is available https://fortipower.github.io/PowerFGT/

      Bug Report / Enhance : https://github.com/FortiPower/PowerFGT

    • 12 replies

      Iescudero
      New Member
      May 28, 2019

      Hello!!

       

      Thank you!! it seems great!

      thedude78
      New Member
      July 8, 2019

      Going to check this out.  I was looking at building some scripts of my own to use the api, but the functionality might already exist here.

       

      Thanks

      alagoutte
      alagoutteAuthorAnswer
      New Member
      January 14, 2020

      A new release of PowerFGT (0.40 is available on PSGallery => https://www.powershellgallery.com/packages/PowerFGT/

      [ul]
    • Enhance Filtering (using directly API) (#58, #62)
    • Add Add/Set/Remove (and member) Address Group (#57)
    • Add Add/Set/Remove Virtual IP (VIP) (#54)
    • Add Add/Remove (and member) Firewall Policy (#65, #68)
    • Add Deploy-FGTVm for deploy FortiGate vapp (#34)
    • Add Timeout setting for Connect-FGT (and Invoke-FGTRestMethod) (#56)[/ul]

      Documentation is available https://fortipower.github.io/PowerFGT/

      Bug Report / Enhance : https://github.com/FortiPower/PowerFGT

    • poundy
      New Member
      January 15, 2020

      thanks for posting here too ! ;)

      SogeKing
      New Member
      October 18, 2023

      Thanks for this great module @alagoutte. Just tried some feature but can't seem to find a way to add mac address to Address or Address Group. Am I missing something?

      alagoutte
      alagoutteAuthor
      New Member
      October 18, 2023

      Hi,

       

      Not yet ! can you ask on Github project ? https://github.com/FortiPower/PowerFGT/issues

      SogeKing
      New Member
      October 18, 2023

      Sure, thanks @alagoutte!

      Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
      Thought Leadership. Security Summit. Thursday, October 8th. Disney's Grand Californian Hotel & SPA, Anaheim, CA.
      Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT