Summary: Store your Windows PowerShell credentials in a variable for later use.
How can I store alternate credentials for repeated use in my Windows PowerShell session?
Use the Get-Credential cmdlet to prompt for a credential, and store the results in a variable:
$credential = Get-Credential