Undos Via Script

I would like to know if it's possible to perform undos via script in Daz Studio. What I want is for the script itself to perform two undos, as if the user had pressed CTRL + Z twice. The intention is to go back to two previous states of the geometry and continue performing more operations from there within the same script. Is this possible? Thank you very much.
Comments
You need to trigger the
DzUndoAction
action. See the Action Trigger Sample Script.Thanks for the tip, Omniflux... I will review it!
I've found that there are certain commands, like "Duplicate", that doesn't get added to the Undo state. Why, I don't know. Nobody has offered an explanation why these commands aren't added to Undo.
At one time no way of adding content to the scene was undoable. I am not sure if not being unable to undo Duplicate is a relic of that or has anothre cause.
There's another bug with Undo. Let's say I have a character that is fully geared (hair,clothing,etc...) and then I delete it. Then I undo it. If the character happens to use geoshells, the geoshell visibility states don't get restored sometimes, or maybe all the time, I just don't notice it. The geoshell may turn white or lose it material parameter properties when this happens. Whatever the case, I think it has something with Undo.