Also, a 1722 error is just reporting a problem with a custom action. That could be due to what you are trying to do, but could also be due to something as simple as a typing error.
So don't make any assumptions about the reason for the error. Just simplify the code and add debugging messages to help determine what is going on.
If using vbscript, remember that you cannot use the wscript. object - so where you might have
wscript.createobject, inside a vbscript custom action, you can only use
createobject.