Creating Gateway Backup through Perspective User Interface on a button event

I tried to create a backup of the gateway from the Perspective User Interface when user clicks a button by using the system.util.execute function and passing the gateway backup creation command as the parameter but unfortunately it isn't working. Could someone help out with the logic which can be utilized for this purpose? Much appreciated.

Could you supply the code you're using so that we could see what might be incorrect?

This works, you just need to make sure that your Ignition service is running under an admin account.

cmd = ['cmd', '/c', r'c:\program files\inductive automation\ignition\gwcmd.bat', '-b', r'c:\temp\bob3.gwbk']

Also, this will be run on the gateway, not on the local client, if run in Perspective, hence the file will appear on the gateway filesystem, not your local filesystem.

If you want to also be able to download it, you can do something like this below. Not sure if there's a better way that doesn't use sleep....?

fn = r'c:\temp\bob.gwbk'
cmd = ['cmd', '/c', r'c:\program files\inductive automation\ignition\gwcmd.bat', '-b', fn]
r = system.util.execute(cmd)
import time
t = 0
checkTime = 5 # seconds
timeout = 60 # seconds
while t < timeout and not system.file.fileExists(fn):
	t += checkTime

if system.file.fileExists(fn):
	data = system.file.readFileAsBytes(fn)'\\')[-1], data)
	system.perspective.print('Timed out waiting for gwbk.')

Hey Nick, thank you so much for this! It's working fine now. Really appreciate it!

Hey there, I just found the solution for it shared by Nick in this thread. It's working fine now. Thanks for the reply! Really appreciate it.