I have a PowerShell script that uses REST to issue commands to EPBCS DM, and it:
1) runs certain Data Rule (ACANRptg-CANRptg);
2) checks for the process status;
3) if the process fails, captures the process log name and id;
4) downloads that log to our batch server (Windows);
5) creates the email and attaches the log to it, then sends it;
(If it sounds familiar, you are right - the script is a modification of the blog entry of one of our most known colleagues . Thanks many times for sharing your knowledge.)
The script has only one parameter, an XML file, that populates paths, environment info, etc.
When I run this in PowerShell ISE console, all works perfectly. But when I try to run it from the command line as:
powershell.exe -command " & 'EPBCS_DATALOAD_TEST.ps1' -xmlFile 'E:\Batches\parameter_files\App_cfg.xml'
(also tried: powershell.exe EPBCS_DATALOAD_TEST.ps1 -xmlFile E:\Batches\parameter_files\App_cfg.xml, with the same - bad - result)
all works fine, EXCEPT the #4 - the download. I get following in the transcript file created by the PS1 script:
"...
Downloading the FDMEE process error log from https://planning-test-<domain, etc.>oraclecloud.com/interop/rest/11.1.2.3.600/applicationsnapshots/outbox%5Clogs%5CACANRptg-CANRptg_1038.log/contents to folder E:\Batches\Logs\CANRPTG\INBOUND\GL\ACANRptg-CANRptg_1038.log .
PS>TerminatingError(Invoke-RestMethod): "null for uri: https://planning-test-<domain, etc.>.oraclecloud.com:443/interop/rest/11.1.2.3.600/applicationsnapshots/outbox/logs/ACANRptg-CANRptg_1038.log/contents564"
ERROR: Download of the log file FAILED!
**********************
Windows PowerShell transcript end
End time: 20181119202148
**********************
"
One thing I notice in those lines, is that in the second URI line, there is a number "564" after the word "/contents" (blue bold in the above code) - I have nothing in my script to insert it. Is it a matter of some special encoding?
Any help is highly appreciated, as this is preventing the implementation of this functionality to our users.
Thanks,
M. Sladic