I’ve been trying to figure out an issue running GPG2.exe (GPG4WIN) from within powershell scripts.
Basically, I have three identical scripts, each pulling from a source directory, they encrypt the file to a different location for SFTP pickup, remove the original, archive and clean out old files in the archive location, and email if there are any issues. They are all running as a domain account with admin rights on the server and modify access to all source and target destinations.
The powershell scripts are scheduled as tasks on windows server 2008. They were all running perfectly as long as I was logged in, once logged out, GPG would stop producing results and exception code 0xc0000005 was logged in the app log.
Seemed that it was DEP causing the issue so I added gpg2.exe to the exception list for the internal server and everything was running fine for about a week.
Then I noticed a debug message was being sent, so to avoid being annoyed by this, I went in and commented out the debug message (which is not used in conditional logic or anything like that) and then the script stopped producing output from gpg… the other two are still working without issue.
I’ve deleted the windows task and recreated it, exported it to xml and validated it then imported it, taken one of the currently working scripts and altered it to the paths of the erroneous one and overwrote the problem script, all with no success… I also removed and added the DEP exception again with no change hoping that a sequence of events was somehow causing this.
The short term solution is to leave my terminal session open, but I would really like to figure this out and I was hoping you may have encountered this issue before. Any help would be tremendously appreciated.