Both the custom action or the It script would work. The custom It script would be cleaner and work better in my opinion but does require a special license to be able to import the custom scripts to your machine.
You could run a custom action on the local console machine but would be as if you were patching it and is a way around needing the ability to import a custom IT script.
If you have the license that allows you to import custom IT scripts you can use those to run the task on the console machine. You would need to create the custom task following specific guidelines that are found in the linked document below.