A) Posts need to be approved - it's possible that none of the mods were available to approve it (until now).
B) - the WriteValue function requires all arguments. If RegType is string, RegData must be "" (empty string), and must be zero for other types. I'm not getting an error unless the data isn't defined (not specified in function).
C) you should be capturing the return code 0 with $Rc = WriteValue(), otherwise you'll litter the screen with result codes.
D)If statements are not functions and do not require parentheses.
E) it's generally considered "bad form" for functions to generate any output. Functions should do a job and return a result. The result can be evaluated and appropriate messages displayed.
F) Declare variables to prevent interference from other functions and main code.
_________________________
Actually I
am a Rocket Scientist!