How to automate Powershell's interactive Get-Credential method?
Your python problem is the \n after the commands, write already append a newline, so your script does the following:

$cred = Get-Credential # Start the command
# This line is ignored as extraneous after Get-Credential, but you can see it in your output.
Administrator # Send proprely to the User: prompt
# Sent to the Password: prompt
Password # Send to the shell input, causing the error at end of your log.


Now that's a quite hard way to automate the credential object in powershell, usually the object is build by other way like described in this blog post (quoting here for completeness):

$password = "mypassword" | ConvertTo-SecureString -asPlainText -Force
$username = "nwtraders\administrator" 
$credential = New-ObjectSystem.Management.Automation.PSCredential($username,$password)


And used as such:

Get-WMIObject win32_logicaldisk -ComputerName Server1 -Credential $credential