Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
bbumanla
New Contributor

How to respond "y" in a script for the factoryreset command?

Hi,

I'm trying to run a script:

execute factoryreset
y

 

to do a factory reset from a Fortimanager script, but not sure how to pipe "y" to the question when it get prompt:

execute factoryreset
echo y


FWF60E # execute factoryreset
This operation will reset the system to factory default!
Do you want to continue? (y/n) <<<<<< what to add in script to execute


FWF60E # execute echo y

command parse error before 'echo'
Command fail. Return code -61

FWF60E #

 

Any info would be helpful oi

 

4 REPLIES 4
amouawad
Staff
Staff

Just enter y in a new line.

 

So the script would be:

 

execute factoryreset
y

 

I just tested and confirmed it works on FMG 6.4.7.

 

2022-03-08_10-35.png

 

bbumanla

This is the original script which is exactly like yours, but I have a lab setup behind a local spectrum router.  At the spectrum router, I have portforwarding setup for https port 443 and http port 80, should I open another port?  From the fortiwifi, Security Fabric>Settings>Use Fortimanager was on and after I ran it the 1 time, from Fortimanger said wan1 was down, but I can get to Fortiwifi it could no longer to the Test Connectivity test.  What other ports should I put my spectrum router/modem to keep the communication up when executing the factoryreset from Fortimanager?

 

bbumanla

If it makes any difference, my 60E is setup to use dhcp.

Debbie_FTNT

You also need TCP/541 at least, that's the port FortiManager/FortiGate use for the management tunnel.

You can find a list of complete ports and protocols here:

https://docs.fortinet.com/document/fortigate/6.4.0/ports-and-protocols/303168

-> there is a FortiGate and a FortiManager section

+++ Divide by Cucumber Error. Please Reinstall Universe and Reboot +++
Labels
Top Kudoed Authors