How to fill the prompt in powershell script

powershell

Solution

There's no Password parameter, you can try with a .NET class:

$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import('C:\test.pfx','123456','DefaultKeySet')

Problem

I use a command like this: ``` get-pfxcertificate C:\test.pfx Enter password: ******* ``` The command ask me to fill the prompt. But I can't do that in my script (test.ps1 for ex) What I need is like this: ``` get-pfxcertificate C:\test.pfx -password "123456" ``` or something similar so I can run my script without fill in the prompt each time I'm very thankful for any reply

Original source