Do we understand correctly that the custom command is configured for the Computer object type and the computer on which the command is executed must be rebooted? If so, you can consider the possibility of using the following approach. In the custom command, add the actions that must be executed before the computer reboot. As the last action in the custom command, add the Update the computer action that will mark the computer by setting a custom Date attribute to the current date/time. Create a scheduled task that will check if the last reboot time of the computer is greater than the value of the custom Date attribute. The check must be performed using the If PowerShell script returns True condition. If the condition is met, the task will execute the actions required after the computer reboot. For information on how to get the date/time when the computer was last rebooted, have a look at the following Microsoft article: https://devblogs.microsoft.com/scripting/powertip-get-the-last-boot-time-with-powershell/.
If this is not what you meant, please, provide us with all the possible details regarding the required behavior with screenshots and live examples.