To prompt for credentials, you should almost always use the [Get-Credential](<https://technet.microsoft.com/en-us/library/hh849815.aspx>) cmdlet:

$credential = Get-Credential

Pre-filled user name:

$credential = Get-Credential -UserName 'myUser'

Add a custom prompt message:

$credential = Get-Credential -Message 'Please enter your company email address and password.'