I want to push out a cert w/ a private key password. I know its not secure. A more secure way would be great. But i cannot figure out to do it.
$test = ConvertTo-SecureString -String "plaintextpassword" -Force -AsPlainText<code>
Import-PfxCertificate -FilePath $filelocale -CertStoreLocation Cert:\LocalMachine\My -Password $test
Getting: Import-PfxCertificate : The PFX file you are trying to import requires either a different password or membership in an Active Directory principal to which it is protected.
If I run below it works
$test = Get-Credential -UserName 'enter pwd' -Message "Enter PWD"
Import-PfxCertificate -FilePath $filelocale -CertStoreLocation Cert:\LocalMachine\My -Password $test.Password