SecureSettings gives you a way to store sensitive information for easy use within PowerShell.
You can store strings, SecureStrings, Credentials, and Hashtables encrypted within the current user's registry. Information is encrypted with Microsoft's DPAPI.
See the code step by step.