Skip to main content
Azuriste
New Member
August 27, 2018
Question

Powershell Script to Backup Fortigates Cofiguration

  • August 27, 2018
  • 3 replies
  • 14411 views

Hello ,  Im looking for a powershell script to backup the configuration of all my fortigates .i have fortigate 60D and 300D . any help please ?

FI : We dont have Fortimanager :)   Regards,

    3 replies

    Ashik_Sheik
    New Member
    August 27, 2018

    Hi ,

     

    Kindly follow the following method,

     

    http://kb.fortinet.com/kb/documentLink.do?externalID=FD39818 

     

    Regds,

     

    Ashik , NSE8

    Azuriste
    AzuristeAuthor
    New Member
    August 27, 2018

    Thanks .But i prefer use a powershell script  to connect to SSH and then launch backup command 

    ede_pfau
    SuperUser
    SuperUser
    August 27, 2018

    For some alternatives, using either pscp.exe from Putty or DLLs, see here:

    https://stackoverflow.com...rnative-for-powershell

    Alexis_G
    New Member
    August 28, 2018
    Ricardo_Tomas
    New Member
    August 28, 2018

    With linux I did it like this:

    #! /usr/bin/expect -f set timeout 8000 set date [clock format [clock seconds] -format {%Y%m%d}] spawn ssh <forti user>@<forti ip> expect "password: " send "<forti password>" expect "$ " send "execute backup full-config ftp $date-backup <ftp server ip> <ftp server user> <ftp server user password> expect "$ " send "exit\r"

     

    sw2090
    SuperUser
    SuperUser
    August 31, 2018

    hm looks a bit the long way :) It will of course do the trick. But maybe you need less code if you just scp your config instead of doing ssh to the FGT and then exec a backup and upload it to a ftp server?

     

    Here is a KB Article that describes how to do that via scp: http://kb.fortinet.com/kb/viewContent.do?externalId=12002

     

    Also there is an older Thread to be found in fortinet forums which is about this: https://forum.fortinet.com/tm.aspx?m=114055

     

    To do scp in powershell you might aswell use freeware like putty's pscp or similar if you don't want/have ps plugins for it. This would then not even require powershell but just a cmd :)

    Elthon_Abreu
    New Member
    August 31, 2018
    Hi, I'm have batch and bash scripts for backup tasks of my Fortigates. I can share them if you like. Best regards.
    Azuriste
    AzuristeAuthor
    New Member
    August 31, 2018

    Hello Elthon Abreu ,

     

    it would be greatful from you .

     

    Thanks

    Elthon_Abreu
    New Member
    August 31, 2018

    Azuriste wrote:

    Hello Elthon Abreu ,

     

    it would be greatful from you .

     

    Thanks

    Look at [link]https://forum.fortinet.com/tm.aspx?m=157597#158374[/link]