Need details how to store passwords as a secure string and use in a script for access to multiple Prism sites. I have a script to collect storage data from multiple Nutanix sites via Prism. Now I need to remove the plain text passwords.
I have located references but only find "NOTE: for security reasons we should store our passwords as a secure string, by declaring these as variables before starting PowerShell." Can anyone provide the steps required to make this work?
Solved
How to store passwords as a secure string and use in a script for access to multiple Prism sites

Best answer by vshuguet
Hi 6373,
Sorry for the delay, I was travelling.
I've put together a quick GitHub Gist with 3 files you can use to showcase the 3 steps you'd need to achieve your goal: https://gist.github.com/shuguet/6cb4577414357c25dbeb3d018a4b7373
Step 1: the "create_key.ps1" file in there is just used to create the encryption key.
Step 2: the "encrypt_password.ps1" file is used for you to encrypt you password and store that in a file.
Those 2 steps you'll most likely do once, and never again until you have to change the password.
Step 3: In file"get_ntnx_vms_with_crypted_passwd.ps1" is an exemple of using this to connect to a Nutanix Cluster and get the list of VMs names.
You can re-use that with whatever you want to do using the Nutanix Cmdlets.
View originalSorry for the delay, I was travelling.
I've put together a quick GitHub Gist with 3 files you can use to showcase the 3 steps you'd need to achieve your goal: https://gist.github.com/shuguet/6cb4577414357c25dbeb3d018a4b7373
Step 1: the "create_key.ps1" file in there is just used to create the encryption key.
Step 2: the "encrypt_password.ps1" file is used for you to encrypt you password and store that in a file.
Those 2 steps you'll most likely do once, and never again until you have to change the password.
Step 3: In file"get_ntnx_vms_with_crypted_passwd.ps1" is an exemple of using this to connect to a Nutanix Cluster and get the list of VMs names.
You can re-use that with whatever you want to do using the Nutanix Cmdlets.
This topic has been closed for comments
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.