0

We are using GPG to encrypt/decrypt files. This gpg is being called in a powershell as follows

 gpg -o $myOfile -d $myDfile
                      #Check if decryption succeeded
                        If($?)
                        {
                          Echo "`nDecryption of $myDfile succeeded"
                          Echo "Decrypted file is $myOfile`n"

When we run the script, the decryption is taking place correctly. After the decryption is done, the script fails with the below error

  • CategoryInfo : NotSpecified: (gpg: Signature ...key ID XXXXXXX:String) [], RemoteException
    • FullyQualifiedErrorId : NativeCommandError

I looked up answers for a few other questions with similar answer but none of the suggestions are working. Any help would be greatly appreciated

Thanks, Sree

2
  • Did you ever figure this out? I have the same issue. Commented Aug 24, 2016 at 17:55
  • The answer mentioned below worked for me. Commented Aug 24, 2016 at 17:58

1 Answer 1

1

$? is not used for the console apps, but for Powershell cmdlets. Try with

if (!$LastExitCode) {

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.