Powershell encryption error: Recovery policy configured for this system contains invalid recovery certificate

I'm trying to encrypt files using powershell, using this command:

(Get-Item -Path MyFile.txt).Encrypt()

But I'm getting this error:

(Get-Item -Path MyFile.txt).Encrypt()
Exception calling "Encrypt" with "0" argument(s): "Recovery policy configured for this system contains invalid recovery certificate.
"
At line:2 char:1
+ (Get-Item -Path MyFile.txt).Encrypt()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : IOException

What is causing this error? Why do I need a recovery certificate?

4 Related questions 2 Powershell and System.Security.Cryptography.X509Certificates.X509Certificate2 0 PowerShell DSC: Error 22 using certs to encrypt creds in a Service Resource 3 Encryption certificates must contain Data Encipherment or Key Encipherment Related questions 2 Powershell and System.Security.Cryptography.X509Certificates.X509Certificate2 0 PowerShell DSC: Error 22 using certs to encrypt creds in a Service Resource 3 Encryption certificates must contain Data Encipherment or Key Encipherment 0 Native Command Error GPG Powershell 4 PowerShell: New-SelfSignedCertificate : CertEnroll::CX509Enrollment::_CreateRequest: Invalid flags specified. 0x80090009 7 Invalid provider type specified. CryptographicException 1 CryptoKeySecurity returns null 0 Powershell fails at pgp decryption 3 PowerShell fails when trying to read certificate store with "The specified network resource or device is no longer available" 2 Getting Exception "Key not valid for use in specified state" while decrypting a file Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like