Secure Passwords With PowerShell Module

This module will securely store passwords in PowerShell with ease. I wrote this back in 2019 while working on replacing some Python code with PowerShell. Recently I needed to use this on another sever and found that it throws a key error.

Import-cliXml: Key not valid for use in specified state.

It makes sense but was something that I hadn’t thought about when initially writing the module.

To get past that issue I added two new methods. It’s a simple export to CSV on the original server and import of the CSV on the other server(s) to create the XML.

The base use of this module allows you store credentials, fetch, and delete and will keep passwords out of your scripts. You can find usage examples in the script itself and you can store passwords for databases, sftp, or Windows accounts.

Using This Module

Simply copy the code, save as PSVault.psm1 and place it where you store your modules or add it to the default PowerShell modules location. Then you should be able to import and use like any other module.

Secure Passwords PowerShell Module Code

PowerShell

Hope this is useful to someone.