Creating a PSCredential object
From MyWiki
<source="text"> $secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)
You can now pass $mycreds to any -PSCredential input parameter </source>