سؤال

I have a Powershell script that I'm trying to get to work from the SAP scheduler. When I run the script in the ISE or from a .bat file, the script works fine. When the script is called from the scheduler (using the same .bat file) I get an error in my log file. The error is "cannot call a method on a null-valued expression". I can't figure out where the error is or why it only shows up when called from the SAP scheduler. How can I go about getting a location for the error? Is there something I can put in a Catch statement to help identify the error? So far I haven't even been able to catch it.


I figured out that the error is that a credential is not being created when the job runs from the scheduler. The password is encrypted and read from a file and the credential is created from this. I can't figure out why it works fine if I run it through the ISE, but does not work through the scheduler. File permissions maybe?

هل كانت مفيدة؟

المحلول

It turns out this was a file permissions error. The task scheduler that runs the job did not have permissions to read the password from the file. In the end I created a job to store the password as a secure string, and ran the job as the service id. Then the service ID had access to the password. Since it will always be the ID that runs the job, it worked out fine.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top