I have added some code to my Scripts/Programs page for securely storing credentials to disk to be used by scripts at a later time.
I explored the VI Credential cmdlets and I was not 100% happy with them so I decided to implement my own version that uses the Microsoft DPAPI for encryption. Make sure to look at the README as it covers usage and current limitations.
I wrote these for use in some automated VMware monitoring I am doing, but there is no reason they have to be used with the VI Toolkit. There are no dependencies on the toolkit.
Please provide feedback if you have any issues with the scripts.