The problem in your script is not that KiX will not accept vars as parms cuz it will. The problem is in how you craft your statements. It is also compounded by he fact you try to do it serially in a loop whilst you modify the keys you enum.

The first parm you malform by not providing quotes and the second you embed in quotes.
(untested)
use $KeyName+':' '\\newserver\'+$Path /persistent

Are you sure it is safe to hard code positions in your SubStr() functions?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.