Skip to main content
otimme
New Member
Jun 18, 2019 9:29 AM UTC
Question

use fcconfig.exe with Python

Hello all

 

for automation purposes I try to write a Python script wich uses fcconfig.exe to safe/load a FortiClient configuration. If I call fcconfig.exe from the command window with runas, it works. I can safe and load the configuration of the installed FortiClient.

 

If I try to do this trough Python, it doesen't work. Any Python pro's here who can help maybe?

 

This is my script:

 

import ctypes, sys

fcconfig_file = 'fcconfig.exe' fcclient_path = "C:\\Program Files\\Fortinet\\FortiClient\\"

fcclient_output_path = 'c:\\temp\\' fcclient_output_file = 'settings.xml' fcclient_arguments = ' -f ' + fcclient_output_path + fcclient_output_file

ret = ctypes.windll.shell32.ShellExecuteW(None, "runas", fcconfig_file, fcclient_arguments, fcclient_path, 1)

 

The script starts, and the UAC asks for permission. But fcconfig.exe does not write out anything.

 

Any ideas? Thanks for your help.

    5 replies

    rwpatterson
    New Member
    Jun 18, 2019 12:43 PM UTC

    Turn off UAC?

    Translate
    otimme
    otimmeAuthor
    New Member
    Jun 18, 2019 12:47 PM UTC

    dumbest idea ever! Not really helpful.

    Translate
    rwpatterson
    New Member
    Jun 18, 2019 1:45 PM UTC

    Look, you said it hangs on UAC. I suggested turning it off. Sorry if you felt my answer was the dumbest ever. Sometimes folks look at the minutia and cannot see the forest for the trees. I went out and made a suggestion. I will no longer do that for you.

     

    Good luck

    Translate
    Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024