I have tried this command on 3 different PC (2008r2 and win7)
read-host -assecurestring | convertfrom-securestring | out-file C:\posh\cred.txt
I used the same user account to create cred.txt and run this command.
In cred.txt just simple text like “jhdfjdhjfdhfjdhjfdf”
An error I got:
PS C:\posh> read-host -assecurestring | convertfrom-securestring | out-file C:\posh\cred.txt
ConvertFrom-SecureString : Cannot process argument because the value of argument "SecureString" is invalid. Change the value of the "SecureString" argument and run the operation again.
At line:1 char:53
+ read-host -assecurestring | convertfrom-securestring <<<< | out-file C:\posh\cred.txt
+ CategoryInfo : InvalidArgument: (:) [ConvertFrom-SecureString],
PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.ConvertFr
omSecureStringCommand
Is there something I’m doing improper way?