Add an -AsCredential switch (or at least -AsSecureString)

Mar 11, 2015 at 10:19 PM
if ($AsCredential)
{
        New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $EntryToFind,(ConvertTo-SecureString ($pwItem.Strings.ReadSafe("Password"))
-AsPlainText -Force)
} else {
        $pwItem.Strings.ReadSafe("Password")
}