While running
'
[System.Management.Automation.PSCredential]::new( "SendEmailCred", (ConvertTo-SecureString -String $cred -AsPlainText -Force) ) | Export-Clixml -Path C:\temp\test.ps1.credential
Method invocation failed because [System.Management.Automation.PSCredential] does not contain a method named 'new'.
At line:1 char:1
+ [System.Management.Automation.PSCredential]::new( "SendEmailCred", (ConvertTo-Se ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
*******************************************************************************************
When ran removing the new in ::new( "SendEmailCred"
powershell works .
THe generated .credentiail file has the following
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">
<Nil />
</Objs>