SMO Certificate Export - FailedOperationException

  • BPRocket

    Valued Member

    Points: 60

    Greetings,

    Given this Powershell SMO method call...

    $_cert.Export("$CertificateLocation\$_cert_name.cer", `
    "$PrivateKeyLocation\$_cert_name.pvk", `
    $_secret)

    where $_cert is a Microsoft.SqlServer.Management.Smo.Certificate object and the arguments are plain strings (not secure strings).

    When I execute the code it returns a FailedOperationError.  I can't figure out why it is failing.  I have tested all the paths in the script to ensure it has access.  I've written test files from within the script to ensure it is not a permissions issue.  Information in the exception has been no help.  I'm frustrated and would appreciate any help figuring this out.

    I can hear someone thinking "why don't you just use t-sql to backup the certificates?"  I prefer the flexibility of executing the script from a central location and not needing to give the SQL service account to some file share.

    Thanks.

  • Site Owners

    SSC Guru

    Points: 80378

    Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply