Using Powershell, You cannot use get-credential without some type of user-prompt.
But!
I found the method without user-prompt window!!
Here is my code
function Get-PSCredential
{
param($userName, $password)
$secured_password = ConvertTo-SecureString $password -AsPlainText -Force
New-object Management.Automation.PSCredential($userName, $secured_password)
}
$cred = Get-PSCredential -userName "Administrator" -password "abcdefghijk"