What's the point of generating the hash with your program? You would have to pass the clear text password within your installer, do you really want to have that there?. Better to generate the RDP profile then either store it within your installer (it contains the hash) or use FileWrite commands to edit/add fields (in case you are generating multiple RDP shortcuts).
Check
this page out.
CF
[Edit] You may also be interested in
this