Security with PowerShell

If you need to get passwords from users and then use these in your PowerShell scripts then you need to look at ConvertTo-SecureString which uses a SecureString Class (System.Security). The examples in both of these are well worth studying. However Using saved credentials securely in PowerShell scripts | Kloud Blog is a highly recommended read as it covers how these work and gives some good solutions.

A good introduction to getting passwords or credentials into a script is available at Using the PowerShell Get-Credential Cmdlet and all things credentials, it's well worth reading.